mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-02 22:32:17 +00:00
refactor: enable clippy::std_instead_of_core lint
This commit is contained in:
parent
d26e64e4c2
commit
807eb59b07
74 changed files with 143 additions and 140 deletions
|
@ -129,8 +129,7 @@ get_unwrap = "warn"
|
|||
similar_names = "warn" # Reduce risk of confusing similar names together, and protects against typos when variable shadowing was intended.
|
||||
str_to_string = "warn"
|
||||
string_to_string = "warn"
|
||||
# TODO: std_instead_of_alloc = "warn"
|
||||
# TODO: std_instead_of_core = "warn"
|
||||
std_instead_of_core = "warn"
|
||||
separated_literal_suffix = "warn"
|
||||
unused_self = "warn"
|
||||
useless_let_if_seq = "warn"
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Sequence for ChannelConnectionSequence {
|
|||
}
|
||||
|
||||
fn step(&mut self, input: &[u8], output: &mut WriteBuf) -> ConnectorResult<Written> {
|
||||
let (written, next_state) = match std::mem::take(&mut self.state) {
|
||||
let (written, next_state) = match core::mem::take(&mut self.state) {
|
||||
ChannelConnectionState::WaitErectDomainRequest => {
|
||||
let erect_domain_request = ironrdp_core::decode::<X224<mcs::ErectDomainPdu>>(input)
|
||||
.map_err(ConnectorError::decode)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::any::TypeId;
|
||||
use std::mem;
|
||||
use core::any::TypeId;
|
||||
use core::mem;
|
||||
|
||||
use ironrdp_connector::{
|
||||
encode_x224_packet, reason_err, ConnectorError, ConnectorErrorExt, ConnectorResult, DesktopSize, Sequence, State,
|
||||
|
|
|
@ -78,7 +78,7 @@ impl Sequence for FinalizationSequence {
|
|||
}
|
||||
|
||||
fn step(&mut self, input: &[u8], output: &mut WriteBuf) -> ConnectorResult<Written> {
|
||||
let (written, next_state) = match std::mem::take(&mut self.state) {
|
||||
let (written, next_state) = match core::mem::take(&mut self.state) {
|
||||
FinalizationState::WaitSynchronize => {
|
||||
let synchronize = decode_share_control(input);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use ironrdp_pdu::PduHint;
|
|||
// https://github.com/rust-lang/rust/issues/91611
|
||||
|
||||
pub trait FramedRead {
|
||||
type ReadFut<'read>: std::future::Future<Output = io::Result<usize>> + 'read
|
||||
type ReadFut<'read>: core::future::Future<Output = io::Result<usize>> + 'read
|
||||
where
|
||||
Self: 'read;
|
||||
|
||||
|
@ -24,7 +24,7 @@ pub trait FramedRead {
|
|||
}
|
||||
|
||||
pub trait FramedWrite {
|
||||
type WriteAllFut<'write>: std::future::Future<Output = io::Result<()>> + 'write
|
||||
type WriteAllFut<'write>: core::future::Future<Output = io::Result<()>> + 'write
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ mod connector;
|
|||
mod framed;
|
||||
mod session;
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
|
||||
use ironrdp_connector::sspi::generator::NetworkRequest;
|
||||
use ironrdp_connector::ConnectorResult;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#![allow(clippy::print_stderr, clippy::print_stdout)] // allowed in this module only
|
||||
|
||||
use std::num::NonZeroU32;
|
||||
use core::num::NonZeroU32;
|
||||
use core::time::Duration;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::time::Instant;
|
||||
|
||||
use raw_window_handle::{DisplayHandle, HasDisplayHandle};
|
||||
use tokio::sync::mpsc;
|
||||
|
@ -37,7 +38,7 @@ impl App {
|
|||
// SAFETY: We drop the softbuffer context right before the event loop is stopped, thus making this safe.
|
||||
// FIXME: This is not a sufficient proof and the API is actually unsound as-is.
|
||||
let display_handle = unsafe {
|
||||
std::mem::transmute::<DisplayHandle<'_>, DisplayHandle<'static>>(event_loop.display_handle().unwrap())
|
||||
core::mem::transmute::<DisplayHandle<'_>, DisplayHandle<'static>>(event_loop.display_handle().unwrap())
|
||||
};
|
||||
let context = softbuffer::Context::new(display_handle)
|
||||
.map_err(|e| anyhow::anyhow!("unable to initialize softbuffer context: {e}"))?;
|
||||
|
@ -165,7 +166,7 @@ impl ApplicationHandler<RdpOutputEvent> for App {
|
|||
event::ElementState::Released => ironrdp::input::Operation::KeyReleased(scancode),
|
||||
};
|
||||
|
||||
let input_events = self.input_database.apply(std::iter::once(operation));
|
||||
let input_events = self.input_database.apply(core::iter::once(operation));
|
||||
|
||||
send_fast_path_events(&self.input_event_sender, input_events);
|
||||
}
|
||||
|
@ -202,7 +203,7 @@ impl ApplicationHandler<RdpOutputEvent> for App {
|
|||
let y = (position.y / win_size.height as f64 * self.buffer_size.1 as f64) as u16;
|
||||
let operation = ironrdp::input::Operation::MouseMove(ironrdp::input::MousePosition { x, y });
|
||||
|
||||
let input_events = self.input_database.apply(std::iter::once(operation));
|
||||
let input_events = self.input_database.apply(core::iter::once(operation));
|
||||
|
||||
send_fast_path_events(&self.input_event_sender, input_events);
|
||||
}
|
||||
|
@ -275,7 +276,7 @@ impl ApplicationHandler<RdpOutputEvent> for App {
|
|||
event::ElementState::Released => ironrdp::input::Operation::MouseButtonReleased(mouse_button),
|
||||
};
|
||||
|
||||
let input_events = self.input_database.apply(std::iter::once(operation));
|
||||
let input_events = self.input_database.apply(core::iter::once(operation));
|
||||
|
||||
send_fast_path_events(&self.input_event_sender, input_events);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use core::num::ParseIntError;
|
||||
use core::str::FromStr;
|
||||
use std::io;
|
||||
use std::num::ParseIntError;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Context as _;
|
||||
use clap::clap_derive::ValueEnum;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::future::Future;
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
use std::pin::Pin;
|
||||
|
||||
use ironrdp::connector::{custom_err, ConnectorResult};
|
||||
use ironrdp_tokio::AsyncNetworkClient;
|
||||
|
|
|
@ -83,7 +83,7 @@ pub fn cf_html_to_plain_html(input: &[u8]) -> Result<&str, HtmlError> {
|
|||
}
|
||||
}
|
||||
|
||||
fn header_value_to_u32(value: &str) -> Result<u32, std::num::ParseIntError> {
|
||||
fn header_value_to_u32(value: &str) -> Result<u32, core::num::ParseIntError> {
|
||||
value.trim_start_matches('0').parse::<u32>()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ pub struct WinClipboard {
|
|||
/// ```
|
||||
///
|
||||
/// Therefore this type should be non-Send and non-Sync to prevent incorrect use.
|
||||
_thread_marker: std::marker::PhantomData<*const ()>,
|
||||
_thread_marker: core::marker::PhantomData<*const ()>,
|
||||
}
|
||||
|
||||
impl WinClipboard {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl<'a> ClipboardDataRef<'a> {
|
|||
pub(crate) fn data(&self) -> &[u8] {
|
||||
let size = self.size();
|
||||
// SAFETY: `data` pointer is valid during the lifetime of the wrapper
|
||||
unsafe { std::slice::from_raw_parts(self.data, size) }
|
||||
unsafe { core::slice::from_raw_parts(self.data, size) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use core::time::Duration;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::mpsc;
|
||||
use std::time::Duration;
|
||||
|
||||
use ironrdp_cliprdr::backend::{ClipboardMessage, ClipboardMessageProxy};
|
||||
use ironrdp_cliprdr::pdu::{ClipboardFormat, ClipboardFormatId, FormatDataRequest, FormatDataResponse};
|
||||
|
@ -165,7 +165,7 @@ impl WinClipboardImpl {
|
|||
}
|
||||
};
|
||||
|
||||
let formats = std::mem::take(&mut self.available_formats_on_remote);
|
||||
let formats = core::mem::take(&mut self.available_formats_on_remote);
|
||||
|
||||
// Clearing clipboard is not required, just render all available formats
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ impl OwnedOsClipboard {
|
|||
pub(crate) fn delay_render(&mut self, format: ClipboardFormatId) -> Result<(), WinCliprdrError> {
|
||||
// SAFETY: We own the clipboard at moment of method invocation, therefore it is safe to
|
||||
// call `SetClipboardData`.
|
||||
let result = unsafe { SetClipboardData(format.value(), HANDLE(std::ptr::null_mut())) };
|
||||
let result = unsafe { SetClipboardData(format.value(), HANDLE(core::ptr::null_mut())) };
|
||||
|
||||
if let Err(err) = result {
|
||||
// `windows` crate will return `Err(..)` on err zero handle, but for `SetClipboardData`
|
||||
|
|
|
@ -58,7 +58,7 @@ impl RemoteClipboardFormatRegistry {
|
|||
let format_name_utf16 = format_name
|
||||
.value()
|
||||
.encode_utf16()
|
||||
.chain(std::iter::once(0))
|
||||
.chain(core::iter::once(0))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let format_name_pcwstr = PCWSTR::from_raw(format_name_utf16.as_ptr());
|
||||
|
|
|
@ -26,7 +26,7 @@ impl GlobalMemoryBuffer {
|
|||
// - `dst` is valid for writes of `data.len()` bytes, we allocated enough above.
|
||||
// - Both `data` and `dst` are properly aligned: u8 alignment is 1
|
||||
// - Memory regions are not overlapping, `dst` was allocated by us just above.
|
||||
unsafe { std::ptr::copy_nonoverlapping(data.as_ptr(), dst as *mut u8, data.len()) };
|
||||
unsafe { core::ptr::copy_nonoverlapping(data.as_ptr(), dst as *mut u8, data.len()) };
|
||||
|
||||
// SAFETY: We called `GlobalLock` on this handle just above.
|
||||
if let Err(error) = unsafe { GlobalUnlock(handle) } {
|
||||
|
@ -67,7 +67,7 @@ pub(crate) unsafe fn render_format(format: ClipboardFormatId, data: &[u8]) -> Wi
|
|||
|
||||
// We successfully transferred ownership of the data to the clipboard, we don't need to
|
||||
// call drop on handle
|
||||
std::mem::forget(global_data);
|
||||
core::mem::forget(global_data);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ pub enum ClipboardMessage {
|
|||
|
||||
/// Proxy to send messages from the os clipboard backend to the main application event loop
|
||||
/// (e.g. winit event loop).
|
||||
pub trait ClipboardMessageProxy: std::fmt::Debug + Send {
|
||||
pub trait ClipboardMessageProxy: core::fmt::Debug + Send {
|
||||
fn send_clipboard_message(&self, message: ClipboardMessage);
|
||||
}
|
||||
|
||||
/// OS-specific clipboard backend interface.
|
||||
pub trait CliprdrBackend: AsAny + std::fmt::Debug + Send {
|
||||
pub trait CliprdrBackend: AsAny + core::fmt::Debug + Send {
|
||||
/// Returns path to local temporary directory where clipboard-transferred files should be
|
||||
/// stored.
|
||||
fn temporary_directory(&self) -> &str;
|
||||
|
|
|
@ -50,7 +50,7 @@ enum CliprdrState {
|
|||
Failed,
|
||||
}
|
||||
|
||||
pub trait Role: std::fmt::Debug + Send + 'static {
|
||||
pub trait Role: core::fmt::Debug + Send + 'static {
|
||||
fn is_server() -> bool;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ pub struct Cliprdr<R: Role> {
|
|||
backend: Box<dyn CliprdrBackend>,
|
||||
capabilities: Capabilities,
|
||||
state: CliprdrState,
|
||||
_marker: std::marker::PhantomData<R>,
|
||||
_marker: core::marker::PhantomData<R>,
|
||||
}
|
||||
|
||||
pub type CliprdrClient = Cliprdr<Client>;
|
||||
|
@ -103,7 +103,7 @@ impl<R: Role> Cliprdr<R> {
|
|||
backend,
|
||||
state: CliprdrState::Initialization,
|
||||
capabilities: Capabilities::new(ClipboardProtocolVersion::V2, flags),
|
||||
_marker: std::marker::PhantomData,
|
||||
_marker: core::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::collections::HashSet;
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_pdu::{mcs, x224::X224, PduHint};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::borrow::Cow;
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use ironrdp_core::{decode, encode_vec, Encode, WriteBuf};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::mem;
|
||||
use core::mem;
|
||||
|
||||
use ironrdp_pdu::rdp::{self, capability_sets::CapabilitySet};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::mem;
|
||||
use core::mem;
|
||||
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_pdu::rdp::capability_sets::SERVER_CHANNEL_ID;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use core::fmt;
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_pdu::rdp::server_license::{self, LicensePdu, ServerLicenseError};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
pub use ironrdp_async::*;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use core::pin::Pin;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures_util::io::{AsyncRead, AsyncWrite};
|
||||
|
@ -42,7 +42,7 @@ impl<S> FramedRead for FuturesStream<S>
|
|||
where
|
||||
S: Send + Sync + Unpin + AsyncRead,
|
||||
{
|
||||
type ReadFut<'read> = Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + Send + Sync + 'read>>
|
||||
type ReadFut<'read> = Pin<Box<dyn core::future::Future<Output = io::Result<usize>> + Send + Sync + 'read>>
|
||||
where
|
||||
Self: 'read;
|
||||
|
||||
|
@ -64,7 +64,7 @@ impl<S> FramedWrite for FuturesStream<S>
|
|||
where
|
||||
S: Send + Sync + Unpin + AsyncWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = Pin<Box<dyn std::future::Future<Output = io::Result<()>> + Send + Sync + 'write>>
|
||||
type WriteAllFut<'write> = Pin<Box<dyn core::future::Future<Output = io::Result<()>> + Send + Sync + 'write>>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
@ -110,7 +110,7 @@ impl<S> FramedRead for LocalFuturesStream<S>
|
|||
where
|
||||
S: Unpin + AsyncRead,
|
||||
{
|
||||
type ReadFut<'read> = Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'read>>
|
||||
type ReadFut<'read> = Pin<Box<dyn core::future::Future<Output = io::Result<usize>> + 'read>>
|
||||
where
|
||||
Self: 'read;
|
||||
|
||||
|
@ -132,7 +132,7 @@ impl<S> FramedWrite for LocalFuturesStream<S>
|
|||
where
|
||||
S: Unpin + AsyncWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'write>>
|
||||
type WriteAllFut<'write> = Pin<Box<dyn core::future::Future<Output = io::Result<()>> + 'write>>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::min;
|
||||
use core::cmp::min;
|
||||
use std::io::{self, Write};
|
||||
|
||||
use crate::image_processing::PixelFormat;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use std::{cmp, io};
|
||||
use core::{cmp, fmt};
|
||||
use std::io;
|
||||
|
||||
use byteorder::WriteBytesExt;
|
||||
use ironrdp_pdu::geometry::{InclusiveRectangle, Rectangle as _};
|
||||
|
@ -15,8 +16,8 @@ pub struct ImageRegionMut<'a> {
|
|||
pub data: &'a mut [u8],
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ImageRegionMut<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Debug for ImageRegionMut<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ImageRegionMut")
|
||||
.field("region", &self.region)
|
||||
.field("step", &self.step)
|
||||
|
@ -33,8 +34,8 @@ pub struct ImageRegion<'a> {
|
|||
pub data: &'a [u8],
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ImageRegion<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Debug for ImageRegion<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ImageRegion")
|
||||
.field("region", &self.region)
|
||||
.field("step", &self.step)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use core::cmp;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use byteorder::ReadBytesExt;
|
||||
|
@ -167,7 +168,7 @@ pub(crate) fn decompress_8bpp_plane(
|
|||
}
|
||||
|
||||
struct RleEncoderScanlineIterator<I> {
|
||||
inner: std::iter::Enumerate<I>,
|
||||
inner: core::iter::Enumerate<I>,
|
||||
width: usize,
|
||||
prev_scanline: Vec<u8>,
|
||||
}
|
||||
|
@ -201,7 +202,7 @@ impl<I: Iterator<Item = u8>> Iterator for RleEncoderScanlineIterator<I> {
|
|||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let (idx, mut next) = self.inner.next()?;
|
||||
|
||||
let prev = std::mem::replace(&mut self.prev_scanline[idx % self.width], next);
|
||||
let prev = core::mem::replace(&mut self.prev_scanline[idx % self.width], next);
|
||||
if idx >= self.width {
|
||||
next = Self::delta_value(prev, next);
|
||||
}
|
||||
|
@ -301,7 +302,7 @@ impl RlePlaneEncoder {
|
|||
raw = &raw[15..];
|
||||
}
|
||||
|
||||
let control = ((raw.len() as u8) << 4) + std::cmp::min(run, 15) as u8;
|
||||
let control = ((raw.len() as u8) << 4) + cmp::min(run, 15) as u8;
|
||||
|
||||
ensure_size!(dst: dst, size: raw.len() + 1);
|
||||
|
||||
|
@ -322,9 +323,9 @@ impl RlePlaneEncoder {
|
|||
while run >= 16 {
|
||||
ensure_size!(dst: dst, size: 1);
|
||||
|
||||
let current = std::cmp::min(run, MAX_DECODED_SEGMENT_SIZE) as u8;
|
||||
let current = cmp::min(run, MAX_DECODED_SEGMENT_SIZE) as u8;
|
||||
|
||||
let c_raw_bytes = std::cmp::min(current / 16, 2);
|
||||
let c_raw_bytes = cmp::min(current / 16, 2);
|
||||
let n_run_length = current - c_raw_bytes * 16;
|
||||
|
||||
let control = (n_run_length << 4) + c_raw_bytes;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::{max, min};
|
||||
use core::cmp::{max, min};
|
||||
|
||||
use ironrdp_pdu::geometry::{InclusiveRectangle, Rectangle as _};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//! - [interleaved.c](https://github.com/FreeRDP/FreeRDP/blob/db98f16e5bce003c898e8c85eb7af964f22a16a8/libfreerdp/codec/interleaved.c#L3)
|
||||
//! - [bitmap.c](https://github.com/FreeRDP/FreeRDP/blob/3a8dce07ea0262b240025bd68b63801578ca63f0/libfreerdp/codec/include/bitmap.c)
|
||||
use core::fmt;
|
||||
use std::ops::BitXor;
|
||||
use core::ops::BitXor;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum RlePixelFormat {
|
||||
|
@ -319,7 +319,7 @@ fn decompress_impl<Mode: DepthMode>(src: &[u8], dst: &mut [u8], row_delta: usize
|
|||
let mut number_to_read = run_length;
|
||||
|
||||
while number_to_read > 0 {
|
||||
let c_bits = std::cmp::min(8, number_to_read);
|
||||
let c_bits = core::cmp::min(8, number_to_read);
|
||||
|
||||
ensure_size!(from: src, size: 1);
|
||||
let bitmask = src.read_u8();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::min;
|
||||
use core::cmp::min;
|
||||
use std::io;
|
||||
|
||||
use bitvec::field::BitField as _;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::ops;
|
||||
use core::ops;
|
||||
|
||||
use bitvec::prelude::{BitSlice, Msb0};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::min;
|
||||
use core::cmp::min;
|
||||
use std::io;
|
||||
|
||||
pub(crate) struct FixedCircularBuffer {
|
||||
|
|
|
@ -380,7 +380,7 @@ impl Database {
|
|||
events.push(FastPathInputEvent::KeyboardEvent(flags, scancode));
|
||||
}
|
||||
|
||||
for character in std::mem::take(&mut self.unicode_keyboard_state).into_iter() {
|
||||
for character in core::mem::take(&mut self.unicode_keyboard_state).into_iter() {
|
||||
let mut utf16_buffer = [0u16; 2];
|
||||
let utf16_code_units = character.encode_utf16(&mut utf16_buffer);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ mod tests;
|
|||
|
||||
pub mod rdp6;
|
||||
|
||||
use std::fmt::{self, Debug};
|
||||
use core::fmt::{self, Debug};
|
||||
|
||||
use bitflags::bitflags;
|
||||
|
||||
|
|
|
@ -173,8 +173,8 @@ pub struct ExtendedBitmapDataPdu<'a> {
|
|||
pub data: &'a [u8],
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ExtendedBitmapDataPdu<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for ExtendedBitmapDataPdu<'_> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("ExtendedBitmapDataPdu")
|
||||
.field("bpp", &self.bpp)
|
||||
.field("codec_id", &self.codec_id)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{fmt, ops};
|
||||
use core::{fmt, ops};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct Rc4 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::{max, min};
|
||||
use core::cmp::{max, min};
|
||||
|
||||
use ironrdp_core::{ensure_fixed_part_size, ReadCursor, WriteCursor};
|
||||
use ironrdp_core::{Decode, DecodeResult, Encode, EncodeResult};
|
||||
|
|
|
@ -704,7 +704,7 @@ fn string_len(value: &str, character_set: CharacterSet) -> u16 {
|
|||
|
||||
pub mod builder {
|
||||
use super::*;
|
||||
use std::marker::PhantomData;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
pub struct ExtendedClientOptionalInfoBuilderStateSetTimeZone;
|
||||
pub struct ExtendedClientOptionalInfoBuilderStateSetSessionId;
|
||||
|
|
|
@ -189,7 +189,7 @@ impl<'de> Decode<'de> for Scope {
|
|||
let mut blob_data = src.read_slice(blob_header.length).to_vec();
|
||||
blob_data.resize(blob_data.len() - UTF8_NULL_TERMINATOR_SIZE, 0);
|
||||
|
||||
if let Ok(data) = std::str::from_utf8(&blob_data) {
|
||||
if let Ok(data) = core::str::from_utf8(&blob_data) {
|
||||
Ok(Self(String::from(data)))
|
||||
} else {
|
||||
Err(invalid_field_err!("scope", "scope is not utf8"))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::fmt::Debug;
|
||||
use core::fmt::Debug;
|
||||
|
||||
use bit_field::BitField;
|
||||
use bitflags::bitflags;
|
||||
|
@ -65,7 +65,7 @@ pub struct Avc420BitmapStream<'a> {
|
|||
}
|
||||
|
||||
impl Debug for Avc420BitmapStream<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("Avc420BitmapStream")
|
||||
.field("rectangles", &self.rectangles)
|
||||
.field("quant_qual_vals", &self.quant_qual_vals)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use byteorder::{LittleEndian, ReadBytesExt as _};
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use std::fmt::Debug;
|
||||
use std::mem::size_of;
|
||||
use std::ops::Add;
|
||||
use core::fmt::Debug;
|
||||
use core::mem::size_of;
|
||||
use core::ops::Add;
|
||||
|
||||
use crate::{DecodeResult, EncodeResult};
|
||||
use ironrdp_core::{ensure_size, invalid_field_err, other_err, ReadCursor, WriteCursor};
|
||||
|
@ -245,7 +245,7 @@ impl<T> SplitTo for &mut [T] {
|
|||
fn split_to(&mut self, n: usize) -> Self {
|
||||
assert!(n <= self.len());
|
||||
|
||||
let (a, b) = std::mem::take(self).split_at_mut(n);
|
||||
let (a, b) = core::mem::take(self).split_at_mut(n);
|
||||
*self = b;
|
||||
|
||||
a
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//! [\[MS-RDPEFS\]: Remote Desktop Protocol: File System Virtual Channel Extension]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpefs/34d9de58-b2b5-40b6-b970-f82d4603bdb5
|
||||
|
||||
use core::fmt;
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::mem::size_of;
|
||||
use core::fmt::{Debug, Display};
|
||||
use core::mem::size_of;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_core::{
|
||||
|
@ -3178,7 +3178,7 @@ impl DeviceReadResponse {
|
|||
}
|
||||
|
||||
impl Debug for DeviceReadResponse {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("DeviceReadResponse")
|
||||
.field("device_io_reply", &self.device_io_reply)
|
||||
.field("read_data", &format!("Vec<u8> of length {}", self.read_data.len()))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
pub mod ndr;
|
||||
pub mod rpce;
|
||||
|
||||
use std::mem::size_of;
|
||||
use core::mem::size_of;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_core::{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
//!
|
||||
//! [smartcard_pack.c]: https://github.com/FreeRDP/FreeRDP/blob/ff303a9bda911c54ffc1b9f2471acd79c897b075/libfreerdp/utils/smartcard_pack.c
|
||||
|
||||
use std::mem::size_of;
|
||||
use core::mem::size_of;
|
||||
|
||||
use ironrdp_core::{ensure_size, invalid_field_err, DecodeResult, EncodeResult, ReadCursor, WriteCursor};
|
||||
use ironrdp_pdu::utils::{self, CharacterSet};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//!
|
||||
//! [\[MS-RPCE\]: Remote Procedure Call Protocol Extensions]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15
|
||||
|
||||
use std::mem::size_of;
|
||||
use core::mem::size_of;
|
||||
|
||||
use ironrdp_core::{
|
||||
cast_length, ensure_size, invalid_field_err, DecodeError, DecodeResult, EncodeResult, ReadCursor, WriteCursor,
|
||||
|
@ -140,12 +140,12 @@ impl<T: HeaderlessEncode> Encode for Pdu<T> {}
|
|||
///
|
||||
/// Implementers should typically avoid implementing this trait directly
|
||||
/// and instead implement [`HeaderlessEncode`], and wrap it in a [`Pdu`].
|
||||
pub trait Encode: ironrdp_core::Encode + Send + std::fmt::Debug {}
|
||||
pub trait Encode: ironrdp_core::Encode + Send + core::fmt::Debug {}
|
||||
|
||||
/// Trait for types that can be encoded into an [MS-RPCE] message.
|
||||
///
|
||||
/// Implementers should typically implement this trait instead of [`Encode`].
|
||||
pub trait HeaderlessEncode: Send + std::fmt::Debug {
|
||||
pub trait HeaderlessEncode: Send + core::fmt::Debug {
|
||||
/// Encodes the instance into a buffer sans its headers.
|
||||
fn encode(&self, dst: &mut WriteCursor<'_>) -> EncodeResult<()>;
|
||||
/// Returns the name associated with this RPCE PDU.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::fmt::{self, Display};
|
||||
use std::mem::size_of;
|
||||
use core::fmt::{self, Display};
|
||||
use core::mem::size_of;
|
||||
|
||||
use ironrdp_core::{
|
||||
ensure_size, invalid_field_err, unsupported_value_err, DecodeError, DecodeResult, EncodeResult, ReadCursor,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
use anyhow::Context;
|
||||
use cpal::traits::StreamTrait;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use std::borrow::Cow;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{self, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
use anyhow::{bail, Context};
|
||||
use cpal::traits::{DeviceTrait, HostTrait};
|
||||
|
|
|
@ -16,7 +16,7 @@ use tracing::{debug, error};
|
|||
use crate::pdu::{self, AudioFormat, PitchPdu, ServerAudioFormatPdu, TrainingPdu, VolumePdu};
|
||||
use crate::server::RdpsndSvcMessages;
|
||||
|
||||
pub trait RdpsndClientHandler: Send + std::fmt::Debug {
|
||||
pub trait RdpsndClientHandler: Send + core::fmt::Debug {
|
||||
fn wave(&mut self, format: &AudioFormat, ts: u32, data: Cow<'_, [u8]>);
|
||||
|
||||
fn set_volume(&mut self, volume: VolumePdu);
|
||||
|
|
|
@ -28,7 +28,7 @@ pub enum RdpsndServerMessage {
|
|||
Error(Box<dyn RdpsndError>),
|
||||
}
|
||||
|
||||
pub trait RdpsndServerHandler: Send + std::fmt::Debug {
|
||||
pub trait RdpsndServerHandler: Send + core::fmt::Debug {
|
||||
fn get_formats(&self) -> &[pdu::AudioFormat];
|
||||
|
||||
fn start(&mut self, client_format: &ClientAudioFormatPdu) -> Option<u16>;
|
||||
|
|
|
@ -187,7 +187,7 @@ struct NoopDisplayUpdates;
|
|||
#[async_trait::async_trait]
|
||||
impl RdpServerDisplayUpdates for NoopDisplayUpdates {
|
||||
async fn next_update(&mut self) -> Option<DisplayUpdate> {
|
||||
let () = std::future::pending().await;
|
||||
let () = core::future::pending().await;
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::num::NonZeroU16;
|
||||
use core::num::NonZeroU16;
|
||||
|
||||
use anyhow::Result;
|
||||
use ironrdp_displaycontrol::pdu::DisplayControlMonitorLayout;
|
||||
|
@ -39,8 +39,8 @@ pub struct RGBAPointer {
|
|||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for RGBAPointer {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for RGBAPointer {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("RGBAPointer")
|
||||
.field("with", &self.width)
|
||||
.field("height", &self.height)
|
||||
|
@ -78,8 +78,8 @@ pub struct BitmapUpdate {
|
|||
pub stride: usize,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for BitmapUpdate {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for BitmapUpdate {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("BitmapUpdate")
|
||||
.field("top", &self.top)
|
||||
.field("left", &self.left)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod bitmap;
|
||||
pub(crate) mod rfx;
|
||||
|
||||
use std::{cmp, mem};
|
||||
use core::{cmp, mem};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use ironrdp_core::Encode;
|
||||
|
|
|
@ -23,7 +23,6 @@ impl RfxEncoder {
|
|||
}
|
||||
|
||||
// FIXME: rewrite to use WriteCursor
|
||||
#[allow(clippy::similar_names)] // It’s hard to find better names for cr, cb, etc.
|
||||
pub(crate) fn encode(&mut self, bitmap: &BitmapUpdate) -> EncodeResult<Vec<u8>> {
|
||||
let width = bitmap.width.get();
|
||||
let height = bitmap.height.get();
|
||||
|
@ -184,6 +183,8 @@ impl<'a> UpdateEncoder<'a> {
|
|||
}
|
||||
|
||||
fn encode_tile<'b>(&self, tile_x: usize, tile_y: usize, buf: &'b mut [u8]) -> Result<EncodedTile<'b>, RlgrError> {
|
||||
#![allow(clippy::similar_names)] // It’s hard to find better names for cr, cb, etc.
|
||||
|
||||
assert!(buf.len() >= 4096 * 3);
|
||||
|
||||
let bpp: usize = self.bitmap.format.bytes_per_pixel().into();
|
||||
|
@ -192,8 +193,8 @@ impl<'a> UpdateEncoder<'a> {
|
|||
|
||||
let x = tile_x * 64;
|
||||
let y = tile_y * 64;
|
||||
let tile_width = std::cmp::min(width - x, 64);
|
||||
let tile_height = std::cmp::min(height - y, 64);
|
||||
let tile_width = core::cmp::min(width - x, 64);
|
||||
let tile_height = core::cmp::min(height - y, 64);
|
||||
let input = &self.bitmap.data[y * self.bitmap.stride + x * bpp..];
|
||||
|
||||
let y = &mut [0i16; 4096];
|
||||
|
|
|
@ -43,10 +43,10 @@ macro_rules! time_warn {
|
|||
($context:expr, $threshold_ms:expr, $op:expr) => {{
|
||||
#[cold]
|
||||
fn warn_log(context: &str, duration: u128) {
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use ::core::sync::atomic::AtomicUsize;
|
||||
|
||||
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||
let current_count = COUNT.fetch_add(1, ::std::sync::atomic::Ordering::Relaxed);
|
||||
let current_count = COUNT.fetch_add(1, ::core::sync::atomic::Ordering::Relaxed);
|
||||
if current_count < 50 || current_count % 100 == 0 {
|
||||
::tracing::warn!("{context} took {duration} ms! (count: {current_count})");
|
||||
}
|
||||
|
|
|
@ -947,7 +947,7 @@ impl<W> FramedWrite for SharedWriter<'_, W>
|
|||
where
|
||||
W: FramedWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = std::pin::Pin<Box<dyn std::future::Future<Output = std::io::Result<()>> + 'write>>
|
||||
type WriteAllFut<'write> = core::pin::Pin<Box<dyn core::future::Future<Output = std::io::Result<()>> + 'write>>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ pub struct DecodedImage {
|
|||
height: u16,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for DecodedImage {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl core::fmt::Debug for DecodedImage {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.debug_struct("DecodedImage")
|
||||
.field("pixel_format", &self.pixel_format)
|
||||
.field("data_len", &self.data.len())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::cmp::min;
|
||||
use core::cmp::min;
|
||||
|
||||
use ironrdp_graphics::color_conversion::{self, YCbCrBuffer};
|
||||
use ironrdp_graphics::rectangle_processing::Region;
|
||||
|
|
|
@ -17,7 +17,7 @@ use alloc::collections::BTreeMap;
|
|||
use core::any::TypeId;
|
||||
use core::fmt;
|
||||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ironrdp_core::{assert_obj_safe, AsAny, DecodeResult, EncodeResult, ReadCursor, WriteBuf, WriteCursor};
|
||||
|
@ -311,7 +311,7 @@ impl ChunkProcessor {
|
|||
// If this was an unchunked message, or the last in a series of chunks, return the payload
|
||||
if last {
|
||||
// Take the chunked_pdu buffer and replace it with an empty one
|
||||
return Ok(Some(std::mem::take(&mut self.chunked_pdu)));
|
||||
return Ok(Some(core::mem::take(&mut self.chunked_pdu)));
|
||||
}
|
||||
|
||||
// This was an intermediate chunk, return None
|
||||
|
@ -341,7 +341,7 @@ impl ChunkProcessor {
|
|||
|
||||
let total_len = encoded_pdu.filled_len();
|
||||
let mut chunk_start_index: usize = 0;
|
||||
let mut chunk_end_index = std::cmp::min(total_len, max_chunk_len);
|
||||
let mut chunk_end_index = core::cmp::min(total_len, max_chunk_len);
|
||||
loop {
|
||||
// Create a buffer to hold this next chunk.
|
||||
// TODO(perf): Reuse this buffer using `clear` and `filled` as appropriate.
|
||||
|
@ -385,7 +385,7 @@ impl ChunkProcessor {
|
|||
|
||||
// Otherwise, update the chunk start and end indices for the next iteration.
|
||||
chunk_start_index = chunk_end_index;
|
||||
chunk_end_index = std::cmp::min(total_len, chunk_end_index.saturating_add(max_chunk_len));
|
||||
chunk_end_index = core::cmp::min(total_len, chunk_end_index.saturating_add(max_chunk_len));
|
||||
}
|
||||
|
||||
Ok(chunks)
|
||||
|
|
|
@ -18,7 +18,7 @@ fn test_encodes<T: Encode>(data: &T, expected: &[u8]) {
|
|||
}
|
||||
|
||||
// TODO: This likely generalizes to many tests and can thus be reused outside of this module.
|
||||
fn test_decodes<'a, T: Decode<'a> + PartialEq + std::fmt::Debug>(encoded: &'a [u8], expected: &T) {
|
||||
fn test_decodes<'a, T: Decode<'a> + PartialEq + core::fmt::Debug>(encoded: &'a [u8], expected: &T) {
|
||||
let mut src = ReadCursor::new(encoded);
|
||||
assert_eq!(*expected, T::decode(&mut src).unwrap());
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ fn mouse_buttons(#[case] button: MouseButton, #[case] expected_flag: MouseFlags)
|
|||
let mut db = Database::default();
|
||||
|
||||
{
|
||||
let packets = db.apply(std::iter::once(Operation::MouseButtonPressed(button)));
|
||||
let packets = db.apply(core::iter::once(Operation::MouseButtonPressed(button)));
|
||||
let packet = packets.into_iter().next().expect("one input event");
|
||||
|
||||
let expected_input_event = match expected_flag {
|
||||
|
@ -41,7 +41,7 @@ fn mouse_buttons(#[case] button: MouseButton, #[case] expected_flag: MouseFlags)
|
|||
}
|
||||
|
||||
{
|
||||
let packets = db.apply(std::iter::once(Operation::MouseButtonReleased(button)));
|
||||
let packets = db.apply(core::iter::once(Operation::MouseButtonReleased(button)));
|
||||
let packet = packets.into_iter().next().expect("one input event");
|
||||
|
||||
let expected_input_event = match expected_flag {
|
||||
|
|
|
@ -42,7 +42,7 @@ fn smoke_mouse_buttons() {
|
|||
let mut db = Database::default();
|
||||
|
||||
for op in ops {
|
||||
db.apply(std::iter::once(op.clone()));
|
||||
db.apply(core::iter::once(op.clone()));
|
||||
|
||||
match op {
|
||||
Operation::MouseButtonPressed(button) => {
|
||||
|
@ -85,7 +85,7 @@ fn smoke_keyboard() {
|
|||
let mut db = Database::default();
|
||||
|
||||
for op in ops {
|
||||
let packets = db.apply(std::iter::once(op.clone()));
|
||||
let packets = db.apply(core::iter::once(op.clone()));
|
||||
|
||||
match op {
|
||||
Operation::KeyPressed(scancode) => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
pub use ironrdp_async::*;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use core::pin::Pin;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadHalf, WriteHalf};
|
||||
|
@ -62,7 +62,7 @@ impl<S> FramedRead for TokioStream<S>
|
|||
where
|
||||
S: Send + Sync + Unpin + AsyncRead,
|
||||
{
|
||||
type ReadFut<'read> = Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + Send + Sync + 'read>>
|
||||
type ReadFut<'read> = Pin<Box<dyn core::future::Future<Output = io::Result<usize>> + Send + Sync + 'read>>
|
||||
where
|
||||
Self: 'read;
|
||||
|
||||
|
@ -77,7 +77,7 @@ impl<S> FramedWrite for TokioStream<S>
|
|||
where
|
||||
S: Send + Sync + Unpin + AsyncWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = Pin<Box<dyn std::future::Future<Output = io::Result<()>> + Send + Sync + 'write>>
|
||||
type WriteAllFut<'write> = Pin<Box<dyn core::future::Future<Output = io::Result<()>> + Send + Sync + 'write>>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
@ -123,7 +123,7 @@ impl<S> FramedRead for LocalTokioStream<S>
|
|||
where
|
||||
S: Unpin + AsyncRead,
|
||||
{
|
||||
type ReadFut<'read> = Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'read>>
|
||||
type ReadFut<'read> = Pin<Box<dyn core::future::Future<Output = io::Result<usize>> + 'read>>
|
||||
where
|
||||
Self: 'read;
|
||||
|
||||
|
@ -138,7 +138,7 @@ impl<S> FramedWrite for LocalTokioStream<S>
|
|||
where
|
||||
S: Unpin + AsyncWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'write>>
|
||||
type WriteAllFut<'write> = Pin<Box<dyn core::future::Future<Output = io::Result<()>> + 'write>>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::num::NonZeroU32;
|
||||
use core::num::NonZeroU32;
|
||||
|
||||
use ironrdp::pdu::geometry::{InclusiveRectangle, Rectangle as _};
|
||||
use softbuffer::{NoDisplayHandle, NoWindowHandle};
|
||||
|
|
|
@ -429,7 +429,7 @@ impl WasmClipboard {
|
|||
.send_cliprdr_message(ClipboardMessage::SendInitiatePaste(*format));
|
||||
} else {
|
||||
// All formats were read, send clipboard to JS
|
||||
let transaction = std::mem::take(&mut self.remote_clipboard);
|
||||
let transaction = core::mem::take(&mut self.remote_clipboard);
|
||||
if transaction.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::pin::Pin;
|
||||
use core::pin::Pin;
|
||||
|
||||
use futures_util::Future;
|
||||
use ironrdp::connector::sspi::generator::NetworkRequest;
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
use core::cell::RefCell;
|
||||
use std::borrow::Cow;
|
||||
use std::num::NonZeroU32;
|
||||
use core::num::NonZeroU32;
|
||||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
use anyhow::Context as _;
|
||||
use base64::Engine as _;
|
||||
|
|
|
@ -23,7 +23,7 @@ extern crate tracing;
|
|||
use std::io::Write as _;
|
||||
use std::net::TcpStream;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
use anyhow::Context as _;
|
||||
use connector::Credentials;
|
||||
|
|
|
@ -7,7 +7,7 @@ pub mod state;
|
|||
pub mod ffi {
|
||||
use diplomat_runtime::DiplomatWriteable;
|
||||
use ironrdp::{connector::Sequence as _, displaycontrol::client::DisplayControlClient};
|
||||
use std::fmt::Write;
|
||||
use core::fmt::Write;
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -94,7 +94,7 @@ pub mod ffi {
|
|||
}
|
||||
|
||||
pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
|
||||
use std::fmt::Write;
|
||||
use core::fmt::Write;
|
||||
let url: &str = self.0.url.as_ref();
|
||||
write!(writeable, "{}", url)?;
|
||||
Ok(())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![allow(clippy::return_self_not_must_use)]
|
||||
use std::fmt::Display;
|
||||
use core::fmt::Display;
|
||||
|
||||
use ironrdp::{cliprdr::backend::ClipboardError, connector::ConnectorError, session::SessionError};
|
||||
#[cfg(target_os = "windows")]
|
||||
|
@ -55,8 +55,8 @@ impl From<std::io::Error> for IronRdpErrorKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::fmt::Error> for IronRdpErrorKind {
|
||||
fn from(_val: std::fmt::Error) -> Self {
|
||||
impl From<core::fmt::Error> for IronRdpErrorKind {
|
||||
fn from(_val: core::fmt::Error) -> Self {
|
||||
IronRdpErrorKind::Generic
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ struct IronRdpErrorInner {
|
|||
#[diplomat::bridge]
|
||||
pub mod ffi {
|
||||
use diplomat_runtime::DiplomatWriteable;
|
||||
use std::fmt::Write as _;
|
||||
use core::fmt::Write as _;
|
||||
|
||||
#[derive(Debug, Clone, Copy, thiserror::Error)]
|
||||
pub enum IronRdpErrorKind {
|
||||
|
@ -177,7 +177,7 @@ impl ValueConsumedError {
|
|||
}
|
||||
|
||||
impl Display for ValueConsumedError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
if let Some(reason) = &self.reason {
|
||||
write!(f, "{}: {}", self.item, reason)
|
||||
} else {
|
||||
|
@ -217,7 +217,7 @@ impl IncorrectEnumTypeErrorBuilder {
|
|||
}
|
||||
|
||||
impl Display for IncorrectEnumTypeError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"expected enum variable {}, of enum {}",
|
||||
|
@ -252,7 +252,7 @@ impl WrongOSError {
|
|||
}
|
||||
|
||||
impl Display for WrongOSError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
if let Some(custom_message) = &self.custom_message {
|
||||
write!(f, "{}", custom_message)?;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ pub mod ffi {
|
|||
}
|
||||
|
||||
pub fn apply(&mut self, operation: &Operation) -> Box<FastPathInputEventIterator> {
|
||||
let res = self.0.apply(std::iter::once(operation.0.clone()));
|
||||
let res = self.0.apply(core::iter::once(operation.0.clone()));
|
||||
Box::new(res.to_vec().into())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ pub fn report(sh: &Shell, html_report: bool) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> {
|
||||
use std::fmt::Write as _;
|
||||
use core::fmt::Write as _;
|
||||
|
||||
const COMMENT_HEADER: &str = "## Coverage Report :robot: :gear:";
|
||||
const DIFF_THRESHOLD: f64 = 0.005;
|
||||
|
|
|
@ -187,14 +187,14 @@ pub fn local_bin() -> PathBuf {
|
|||
path
|
||||
}
|
||||
|
||||
static VERBOSE: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||
static VERBOSE: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicBool::new(false);
|
||||
|
||||
pub fn set_verbose(value: bool) {
|
||||
VERBOSE.store(value, std::sync::atomic::Ordering::Release);
|
||||
VERBOSE.store(value, core::sync::atomic::Ordering::Release);
|
||||
}
|
||||
|
||||
pub fn is_verbose() -> bool {
|
||||
VERBOSE.load(std::sync::atomic::Ordering::Acquire)
|
||||
VERBOSE.load(core::sync::atomic::Ordering::Acquire)
|
||||
}
|
||||
|
||||
pub fn list_files(sh: &Shell, path: impl AsRef<Path>) -> anyhow::Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue