diff --git a/benches/src/perfenc.rs b/benches/src/perfenc.rs index 30ce2248..3f5a302f 100644 --- a/benches/src/perfenc.rs +++ b/benches/src/perfenc.rs @@ -41,7 +41,7 @@ async fn main() -> Result<(), anyhow::Error> { let filename: String = args.free_from_str().context("missing RGBX input filename")?; let file = File::open(&filename) .await - .with_context(|| format!("Failed to open file: {}", filename))?; + .with_context(|| format!("Failed to open file: {filename}"))?; let mut flags = CmdFlags::all(); let mut update_codecs = UpdateEncoderCodecs::new(); @@ -83,8 +83,8 @@ async fn main() -> Result<(), anyhow::Error> { let ratio = total_enc as f64 / total_raw as f64; let percent = 100.0 - ratio * 100.0; - println!("Encoder: {:?}", encoder); - println!("Nb updates: {:?}", n_updates); + println!("Encoder: {encoder:?}"); + println!("Nb updates: {n_updates:?}"); println!( "Sum of bytes: {}/{} ({:.2}%)", bytesize::ByteSize(total_enc), diff --git a/clippy.toml b/clippy.toml index 7a0e8bd2..d468261c 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,4 +1,4 @@ -msrv = "1.75" +msrv = "1.84" semicolon-outside-block-ignore-multiline = true accept-comment-above-statement = true accept-comment-above-attributes = true diff --git a/crates/ironrdp-async/src/framed.rs b/crates/ironrdp-async/src/framed.rs index f628338b..f7c2ac92 100644 --- a/crates/ironrdp-async/src/framed.rs +++ b/crates/ironrdp-async/src/framed.rs @@ -152,7 +152,7 @@ where return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); } } - Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)), + Err(e) => return Err(io::Error::other(e)), }; } } @@ -167,10 +167,7 @@ where /// Data may have been read, but it will be stored in the internal buffer. pub async fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result { loop { - match hint - .find_size(self.peek()) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))? - { + match hint.find_size(self.peek()).map_err(io::Error::other)? { Some((matched, length)) => { let bytes = self.read_exact(length).await?.freeze(); if matched { diff --git a/crates/ironrdp-bench/benches/bench.rs b/crates/ironrdp-bench/benches/bench.rs index 1d8a3830..52e217fa 100644 --- a/crates/ironrdp-bench/benches/bench.rs +++ b/crates/ironrdp-bench/benches/bench.rs @@ -1,4 +1,4 @@ -use std::num::NonZero; +use core::num::NonZero; use criterion::{criterion_group, criterion_main, Criterion}; use ironrdp_graphics::color_conversion::to_64x64_ycbcr_tile; diff --git a/crates/ironrdp-blocking/src/framed.rs b/crates/ironrdp-blocking/src/framed.rs index e12483a9..d44f7881 100644 --- a/crates/ironrdp-blocking/src/framed.rs +++ b/crates/ironrdp-blocking/src/framed.rs @@ -81,7 +81,7 @@ where return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); } } - Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)), + Err(e) => return Err(io::Error::other(e)), }; } } @@ -89,10 +89,7 @@ where /// Reads a frame using the provided PduHint. pub fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result { loop { - match hint - .find_size(self.peek()) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))? - { + match hint.find_size(self.peek()).map_err(io::Error::other)? { Some((matched, length)) => { let bytes = self.read_exact(length)?.freeze(); if matched { diff --git a/crates/ironrdp-client/src/config.rs b/crates/ironrdp-client/src/config.rs index eed26fc3..b109bb00 100644 --- a/crates/ironrdp-client/src/config.rs +++ b/crates/ironrdp-client/src/config.rs @@ -85,12 +85,12 @@ impl Destination { let addr = addr.into(); if let Some(idx) = addr.rfind(':') { - if let Ok(sock_addr) = addr.parse::() { + if let Ok(sock_addr) = addr.parse::() { Ok(Self { name: sock_addr.ip().to_string(), port: sock_addr.port(), }) - } else if addr.parse::().is_ok() { + } else if addr.parse::().is_ok() { Ok(Self { name: addr, port: RDP_DEFAULT_PORT, @@ -314,7 +314,7 @@ impl Config { let codecs = match client_codecs_capabilities(&codecs) { Ok(codecs) => codecs, Err(help) => { - print!("{}", help); + print!("{help}"); std::process::exit(0); } }; diff --git a/crates/ironrdp-cliprdr-format/src/html.rs b/crates/ironrdp-cliprdr-format/src/html.rs index 0f7d5801..585948b4 100644 --- a/crates/ironrdp-cliprdr-format/src/html.rs +++ b/crates/ironrdp-cliprdr-format/src/html.rs @@ -128,10 +128,10 @@ pub fn plain_html_to_cf_html(fragment: &str) -> String { let end_html_pos = buffer.len(); - let start_html_pos_value = format!("{:0>10}", start_html_pos); - let end_html_pos_value = format!("{:0>10}", end_html_pos); - let start_fragment_pos_value = format!("{:0>10}", start_fragment_pos); - let end_fragment_pos_value = format!("{:0>10}", end_fragment_pos); + let start_html_pos_value = format!("{start_html_pos:0>10}"); + let end_html_pos_value = format!("{end_html_pos:0>10}"); + let start_fragment_pos_value = format!("{start_fragment_pos:0>10}"); + let end_fragment_pos_value = format!("{end_fragment_pos:0>10}"); let mut replace_placeholder = |value_begin_idx: usize, header_value: &str| { // We know that: value_begin_idx + POS_PLACEHOLDER.len() < usize::MAX diff --git a/crates/ironrdp-cliprdr/src/backend.rs b/crates/ironrdp-cliprdr/src/backend.rs index b000735f..c680b031 100644 --- a/crates/ironrdp-cliprdr/src/backend.rs +++ b/crates/ironrdp-cliprdr/src/backend.rs @@ -7,9 +7,9 @@ use crate::pdu::{ FormatDataRequest, FormatDataResponse, LockDataId, OwnedFormatDataResponse, }; -pub trait ClipboardError: std::error::Error + Send + Sync + 'static {} +pub trait ClipboardError: core::error::Error + Send + Sync + 'static {} -impl ClipboardError for T where T: std::error::Error + Send + Sync + 'static {} +impl ClipboardError for T where T: core::error::Error + Send + Sync + 'static {} /// Message sent by the OS clipboard backend event loop. #[derive(Debug)] diff --git a/crates/ironrdp-connector/src/connection.rs b/crates/ironrdp-connector/src/connection.rs index 1ee02fb2..85693d3c 100644 --- a/crates/ironrdp-connector/src/connection.rs +++ b/crates/ironrdp-connector/src/connection.rs @@ -1,6 +1,6 @@ use core::mem; +use core::net::SocketAddr; use std::borrow::Cow; -use std::net::SocketAddr; use std::sync::Arc; use ironrdp_core::{decode, encode_vec, Encode, WriteBuf}; @@ -615,7 +615,7 @@ fn create_gcc_blocks<'a>( 16 => SupportedColorDepths::BPP16, 24 => SupportedColorDepths::BPP24, 32 => SupportedColorDepths::BPP32 | SupportedColorDepths::BPP16, - _ => panic!("Unsupported color depth: {}", max_color_depth), + _ => panic!("Unsupported color depth: {max_color_depth}"), }; let channels = static_channels diff --git a/crates/ironrdp-connector/src/lib.rs b/crates/ironrdp-connector/src/lib.rs index 8a4558df..f84f9826 100644 --- a/crates/ironrdp-connector/src/lib.rs +++ b/crates/ironrdp-connector/src/lib.rs @@ -292,8 +292,8 @@ impl fmt::Display for ConnectorErrorKind { } } -impl std::error::Error for ConnectorErrorKind { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for ConnectorErrorKind { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match &self { ConnectorErrorKind::Encode(e) => Some(e), ConnectorErrorKind::Decode(e) => Some(e), @@ -315,7 +315,7 @@ pub trait ConnectorErrorExt { fn reason(context: &'static str, reason: impl Into) -> Self; fn custom(context: &'static str, e: E) -> Self where - E: std::error::Error + Sync + Send + 'static; + E: core::error::Error + Sync + Send + 'static; } impl ConnectorErrorExt for ConnectorError { @@ -337,7 +337,7 @@ impl ConnectorErrorExt for ConnectorError { fn custom(context: &'static str, e: E) -> Self where - E: std::error::Error + Sync + Send + 'static, + E: core::error::Error + Sync + Send + 'static, { Self::new(context, ConnectorErrorKind::Custom).with_source(e) } @@ -349,7 +349,7 @@ pub trait ConnectorResultExt { #[must_use] fn with_source(self, source: E) -> Self where - E: std::error::Error + Sync + Send + 'static; + E: core::error::Error + Sync + Send + 'static; } impl ConnectorResultExt for ConnectorResult { @@ -362,7 +362,7 @@ impl ConnectorResultExt for ConnectorResult { fn with_source(self, source: E) -> Self where - E: std::error::Error + Sync + Send + 'static, + E: core::error::Error + Sync + Send + 'static, { self.map_err(|e| e.with_source(source)) } diff --git a/crates/ironrdp-connector/src/server_name.rs b/crates/ironrdp-connector/src/server_name.rs index 5703ad32..4f5854eb 100644 --- a/crates/ironrdp-connector/src/server_name.rs +++ b/crates/ironrdp-connector/src/server_name.rs @@ -35,10 +35,10 @@ impl From<&str> for ServerName { fn sanitize_server_name(name: String) -> String { if let Some(idx) = name.rfind(':') { - if let Ok(sock_addr) = name.parse::() { + if let Ok(sock_addr) = name.parse::() { // A socket address, including a port sock_addr.ip().to_string() - } else if name.parse::().is_ok() { + } else if name.parse::().is_ok() { // An IPv6 address with no port, do not include a port, already sane name } else { diff --git a/crates/ironrdp-core/src/cursor.rs b/crates/ironrdp-core/src/cursor.rs index 4501377f..16709847 100644 --- a/crates/ironrdp-core/src/cursor.rs +++ b/crates/ironrdp-core/src/cursor.rs @@ -34,7 +34,7 @@ impl fmt::Display for NotEnoughBytesError { } #[cfg(feature = "std")] -impl std::error::Error for NotEnoughBytesError {} +impl core::error::Error for NotEnoughBytesError {} macro_rules! ensure_enough_bytes { (in: $buf:ident, size: $expected:expr) => {{ diff --git a/crates/ironrdp-core/src/decode.rs b/crates/ironrdp-core/src/decode.rs index cf56a50f..910c95ff 100644 --- a/crates/ironrdp-core/src/decode.rs +++ b/crates/ironrdp-core/src/decode.rs @@ -64,7 +64,7 @@ pub enum DecodeErrorKind { } #[cfg(feature = "std")] -impl std::error::Error for DecodeErrorKind {} +impl core::error::Error for DecodeErrorKind {} impl fmt::Display for DecodeErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/ironrdp-core/src/encode.rs b/crates/ironrdp-core/src/encode.rs index c1e9c0e1..ee8bea43 100644 --- a/crates/ironrdp-core/src/encode.rs +++ b/crates/ironrdp-core/src/encode.rs @@ -68,7 +68,7 @@ pub enum EncodeErrorKind { } #[cfg(feature = "std")] -impl std::error::Error for EncodeErrorKind {} +impl core::error::Error for EncodeErrorKind {} impl fmt::Display for EncodeErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/ironrdp-dvc-pipe-proxy/src/windows/error.rs b/crates/ironrdp-dvc-pipe-proxy/src/windows/error.rs index 9c2f471d..b0dacb2c 100644 --- a/crates/ironrdp-dvc-pipe-proxy/src/windows/error.rs +++ b/crates/ironrdp-dvc-pipe-proxy/src/windows/error.rs @@ -21,7 +21,7 @@ impl core::fmt::Display for WindowsError { WindowsError::CreateNamedPipe(_) => write!(f, "failed to create named pipe"), WindowsError::CreateEvent(_) => write!(f, "failed to create event object"), WindowsError::SetEvent(_) => write!(f, "failed to set event to signaled state"), - WindowsError::InvalidSemaphoreParams(cause) => write!(f, "invalid semaphore parameters: {}", cause), + WindowsError::InvalidSemaphoreParams(cause) => write!(f, "invalid semaphore parameters: {cause}"), WindowsError::ReleaseSemaphore(_) => write!(f, "failed to release semaphore"), WindowsError::WaitForMultipleObjectsFailed(_) => write!(f, "failed to wait for multiple objects"), WindowsError::WaitForMultipleObjectsTimeout => write!(f, "timed out waiting for multiple objects"), @@ -32,7 +32,7 @@ impl core::fmt::Display for WindowsError { WindowsError::OverlappedRead(_) => write!(f, "overlapped read failed"), WindowsError::OverlappedWrite(_) => write!(f, "overlapped write failed"), WindowsError::CreateSemaphore(_) => write!(f, "failed to create semaphore object"), - WindowsError::InvalidPipeName(cause) => write!(f, "invalid pipe name: `{}`", cause), + WindowsError::InvalidPipeName(cause) => write!(f, "invalid pipe name: `{cause}`"), } } } diff --git a/crates/ironrdp-dvc/src/pdu.rs b/crates/ironrdp-dvc/src/pdu.rs index c57e2235..0b081b6d 100644 --- a/crates/ironrdp-dvc/src/pdu.rs +++ b/crates/ironrdp-dvc/src/pdu.rs @@ -272,7 +272,7 @@ impl fmt::Display for Cmd { impl From for String { fn from(cmd: Cmd) -> Self { - format!("{:?}", cmd) + format!("{cmd:?}") } } diff --git a/crates/ironrdp-error/src/lib.rs b/crates/ironrdp-error/src/lib.rs index a36f5d01..b57c3e69 100644 --- a/crates/ironrdp-error/src/lib.rs +++ b/crates/ironrdp-error/src/lib.rs @@ -9,10 +9,10 @@ use alloc::boxed::Box; use core::fmt; #[cfg(feature = "std")] -pub trait Source: std::error::Error + Sync + Send + 'static {} +pub trait Source: core::error::Error + Sync + Send + 'static {} #[cfg(feature = "std")] -impl Source for T where T: std::error::Error + Sync + Send + 'static {} +impl Source for T where T: core::error::Error + Sync + Send + 'static {} #[cfg(not(feature = "std"))] pub trait Source: fmt::Display + fmt::Debug + Send + Sync + 'static {} @@ -25,7 +25,7 @@ pub struct Error { pub context: &'static str, pub kind: Kind, #[cfg(feature = "std")] - source: Option>, + source: Option>, #[cfg(all(not(feature = "std"), feature = "alloc"))] source: Option>, } @@ -94,11 +94,11 @@ where } #[cfg(feature = "std")] -impl std::error::Error for Error +impl core::error::Error for Error where - Kind: std::error::Error, + Kind: core::error::Error, { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { if let Some(source) = self.kind.source() { Some(source) } else { @@ -115,10 +115,10 @@ where #[cfg(feature = "std")] impl From> for std::io::Error where - Kind: std::error::Error + Send + Sync + 'static, + Kind: core::error::Error + Send + Sync + 'static, { fn from(error: Error) -> Self { - Self::new(std::io::ErrorKind::Other, error) + Self::other(error) } } @@ -127,10 +127,10 @@ pub struct ErrorReport<'a, Kind>(&'a Error); #[cfg(feature = "std")] impl fmt::Display for ErrorReport<'_, Kind> where - Kind: std::error::Error, + Kind: core::error::Error, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use std::error::Error; + use core::error::Error; write!(f, "{}", self.0)?; diff --git a/crates/ironrdp-glutin-renderer/src/lib.rs b/crates/ironrdp-glutin-renderer/src/lib.rs index 359da250..19baa412 100644 --- a/crates/ironrdp-glutin-renderer/src/lib.rs +++ b/crates/ironrdp-glutin-renderer/src/lib.rs @@ -11,5 +11,5 @@ pub mod renderer; mod draw; mod surface; -type Error = Box; +type Error = Box; type Result = std::result::Result; diff --git a/crates/ironrdp-graphics/src/pointer.rs b/crates/ironrdp-graphics/src/pointer.rs index 862236d4..2d4b6c0d 100644 --- a/crates/ironrdp-graphics/src/pointer.rs +++ b/crates/ironrdp-graphics/src/pointer.rs @@ -372,11 +372,11 @@ impl ColorStrideReader { } fn bit_stride_size_align_u8(size_bits: usize) -> usize { - (size_bits + 7) / 8 + size_bits.div_ceil(8) } fn bit_stride_size_align_u16(size_bits: usize) -> usize { - ((size_bits + 15) / 16) * 2 + size_bits.div_ceil(16) * 2 } /// Message-agnostic pointer data. diff --git a/crates/ironrdp-graphics/src/rdp6/bitmap_stream/decoder.rs b/crates/ironrdp-graphics/src/rdp6/bitmap_stream/decoder.rs index ffdaa638..59f3a7b0 100644 --- a/crates/ironrdp-graphics/src/rdp6/bitmap_stream/decoder.rs +++ b/crates/ironrdp-graphics/src/rdp6/bitmap_stream/decoder.rs @@ -48,7 +48,7 @@ impl<'a> BitmapStreamDecoderImpl<'a> { // its size is rounded up to the nearest greater integer, to take into account odd image // size (e.g. if width is 3, then chroma plane width is 2, not 1, to take into account // the odd column which expands to 1 pixel instead of 2 during supersampling) - ((image_width + 1) / 2, (image_height + 1) / 2) + (image_width.div_ceil(2), image_height.div_ceil(2)) } else { (image_width, image_height) }; diff --git a/crates/ironrdp-pdu/README.md b/crates/ironrdp-pdu/README.md index e69f57fd..256194ed 100644 --- a/crates/ironrdp-pdu/README.md +++ b/crates/ironrdp-pdu/README.md @@ -324,7 +324,7 @@ Several other concerns arise: - `Unknown(2)` and `ThirdValue` are conceptually the same thing, but are represented differently in memory. - The default `PartialEq` implementation that can be derived will return `false` when testing for - equality (i.e.: `Unknown(2) != ThirdValue`). Fixing this requires manual implementation of `PartialEq`. + equality (i.e.: `Unknown(2) != ThirdValue`). Fixing this requires manual implementation of `PartialEq`. - Even if `PartialEq` is fixed, the pattern matching issue can’t be fixed. - The size of this type is bigger than necessary. @@ -414,11 +414,11 @@ The **TL;DR** is: - Use **both** `from_bits_retain` and `const _ = !0` when resilient parsing is required. - `const _ = !0` ensures we don’t accidentally have non resilient or destructive parsing. In - addition to that, generated methods such as `complement` (`!`) will consider additional bits - and follow the principle of least surprise (`!!flags == flags`). + addition to that, generated methods such as `complement` (`!`) will consider additional bits + and follow the principle of least surprise (`!!flags == flags`). - `from_bits_retain` makes it clear at the call site that preserving all the bits is intentional. - Use `from_bits` WITHOUT `const _ = !0` when strictness is required (almost never in IronRDP), and - document why with an in-source comment. + document why with an in-source comment. Bit flags are used quite pervasively in the RDP protocol. IronRDP is relying on the [`bitflags` crate][bitflags] to generate well-defined flags structures, diff --git a/crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs b/crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs index c21e582a..c2153736 100644 --- a/crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs +++ b/crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs @@ -59,7 +59,7 @@ impl Encode for BitmapStreamHeader { let mut header = ((self.enable_rle_compression as u8) << 4) | ((!self.use_alpha as u8) << 5); match self.color_plane_definition { - ColorPlaneDefinition::Argb { .. } => { + ColorPlaneDefinition::Argb => { // ARGB color planes keep cll and cs flags set to 0 } ColorPlaneDefinition::AYCoCg { @@ -108,7 +108,7 @@ impl<'a> BitmapStream<'a> { pub fn has_subsampled_chroma(&self) -> bool { match self.header.color_plane_definition { - ColorPlaneDefinition::Argb { .. } => false, + ColorPlaneDefinition::Argb => false, ColorPlaneDefinition::AYCoCg { use_chroma_subsampling, .. } => use_chroma_subsampling, diff --git a/crates/ironrdp-pdu/src/lib.rs b/crates/ironrdp-pdu/src/lib.rs index 72522185..afe3dc55 100644 --- a/crates/ironrdp-pdu/src/lib.rs +++ b/crates/ironrdp-pdu/src/lib.rs @@ -65,7 +65,7 @@ impl PduErrorExt for PduError { } } -impl std::error::Error for PduErrorKind {} +impl core::error::Error for PduErrorKind {} impl fmt::Display for PduErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/ironrdp-pdu/src/mcs.rs b/crates/ironrdp-pdu/src/mcs.rs index a283686a..799a2908 100644 --- a/crates/ironrdp-pdu/src/mcs.rs +++ b/crates/ironrdp-pdu/src/mcs.rs @@ -1180,7 +1180,7 @@ mod legacy { impl From for io::Error { fn from(e: McsError) -> io::Error { - io::Error::new(io::ErrorKind::Other, format!("MCS Connection Sequence error: {e}")) + io::Error::other(format!("MCS Connection Sequence error: {e}")) } } } diff --git a/crates/ironrdp-pdu/src/per.rs b/crates/ironrdp-pdu/src/per.rs index 0602f8be..d4ea96b0 100644 --- a/crates/ironrdp-pdu/src/per.rs +++ b/crates/ironrdp-pdu/src/per.rs @@ -23,7 +23,7 @@ pub(crate) enum PerError { NumericStringTooBig, } -impl std::error::Error for PerError {} +impl core::error::Error for PerError {} impl fmt::Display for PerError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -276,7 +276,7 @@ pub(crate) fn write_octet_string(dst: &mut WriteCursor<'_>, octet_string: &[u8], pub(crate) fn read_numeric_string(src: &mut ReadCursor<'_>, min: u16) -> Result<(), PerError> { let (length, _) = read_length(src)?; - let length = usize::from((length + min + 1) / 2); + let length = usize::from((length + min).div_ceil(2)); if src.len() < length { Err(PerError::NotEnoughBytes { @@ -525,7 +525,7 @@ pub(crate) mod legacy { pub(crate) fn read_numeric_string(mut stream: impl io::Read, min: u16) -> io::Result<()> { let (read_length, _) = read_length(&mut stream)?; - let length = (read_length + min + 1) / 2; + let length = (read_length + min).div_ceil(2); let mut read_numeric_string = vec![0; length as usize]; stream.read_exact(read_numeric_string.as_mut())?; diff --git a/crates/ironrdp-pdu/src/rdp.rs b/crates/ironrdp-pdu/src/rdp.rs index a97f17d1..1d28a272 100644 --- a/crates/ironrdp-pdu/src/rdp.rs +++ b/crates/ironrdp-pdu/src/rdp.rs @@ -112,6 +112,6 @@ impl From for RdpError { impl From for io::Error { fn from(e: RdpError) -> io::Error { - io::Error::new(io::ErrorKind::Other, format!("RDP Connection Sequence error: {e}")) + io::Error::other(format!("RDP Connection Sequence error: {e}")) } } diff --git a/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs index 07c28b32..32162e94 100644 --- a/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs +++ b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs @@ -627,7 +627,7 @@ impl Debug for CodecId { 3 => "RemoteFx", _ => "unknown", }; - write!(f, "CodecId({})", name) + write!(f, "CodecId({name})") } } @@ -672,7 +672,7 @@ pub fn client_codecs_capabilities(config: &[&str]) -> Result true, "off" => false, - _ => return Err(format!("Unhandled configuration: {}", state_str)), + _ => return Err(format!("Unhandled configuration: {state_str}")), }; result.insert(codec_name, state); @@ -710,7 +710,7 @@ List of codecs: let codec_names = config.keys().copied().collect::>().join(", "); if !codec_names.is_empty() { - return Err(format!("Unknown codecs: {}", codec_names)); + return Err(format!("Unknown codecs: {codec_names}")); } Ok(BitmapCodecs(codecs)) diff --git a/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs index f5fed5a7..84e6ac42 100644 --- a/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs +++ b/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs @@ -24,7 +24,7 @@ bitflags! { /// /// * `flags` - virtual channel compression flags /// * `chunk_size` - when sent from server to client, this field contains the maximum allowed size of a virtual channel chunk and MUST be greater than or equal to 1600 and less than or equal to 16256. -/// When sent from client to server, the value in this field is ignored by the server. This value is not verified in IronRDP and MUST be verified on the caller's side +/// When sent from client to server, the value in this field is ignored by the server. This value is not verified in IronRDP and MUST be verified on the caller's side /// /// # MSDN /// diff --git a/crates/ironrdp-pdu/src/rdp/vc.rs b/crates/ironrdp-pdu/src/rdp/vc.rs index ae465291..7d166540 100644 --- a/crates/ironrdp-pdu/src/rdp/vc.rs +++ b/crates/ironrdp-pdu/src/rdp/vc.rs @@ -111,6 +111,6 @@ impl From for ChannelError { impl From for io::Error { fn from(e: ChannelError) -> io::Error { - io::Error::new(io::ErrorKind::Other, format!("Virtual channel error: {e}")) + io::Error::other(format!("Virtual channel error: {e}")) } } diff --git a/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs index 450dc77f..6f341f77 100644 --- a/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs +++ b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs @@ -48,7 +48,7 @@ impl CapabilitySet { CapabilitySet::V8 { .. } => CapabilityVersion::V8, CapabilitySet::V8_1 { .. } => CapabilityVersion::V8_1, CapabilitySet::V10 { .. } => CapabilityVersion::V10, - CapabilitySet::V10_1 { .. } => CapabilityVersion::V10_1, + CapabilitySet::V10_1 => CapabilityVersion::V10_1, CapabilitySet::V10_2 { .. } => CapabilityVersion::V10_2, CapabilitySet::V10_3 { .. } => CapabilityVersion::V10_3, CapabilitySet::V10_4 { .. } => CapabilityVersion::V10_4, @@ -109,7 +109,7 @@ impl Encode for CapabilitySet { | CapabilitySet::V10_6 { .. } | CapabilitySet::V10_6Err { .. } | CapabilitySet::V10_7 { .. } => 4, - CapabilitySet::V10_1 { .. } => 16, + CapabilitySet::V10_1 => 16, CapabilitySet::Unknown(data) => data.len(), } } diff --git a/crates/ironrdp-rdcleanpath/src/lib.rs b/crates/ironrdp-rdcleanpath/src/lib.rs index 4294b597..db44d403 100644 --- a/crates/ironrdp-rdcleanpath/src/lib.rs +++ b/crates/ironrdp-rdcleanpath/src/lib.rs @@ -47,7 +47,7 @@ impl fmt::Display for RDCleanPathErr { } } -impl std::error::Error for RDCleanPathErr {} +impl core::error::Error for RDCleanPathErr {} #[derive(Clone, Debug, Eq, PartialEq, der::Sequence)] #[asn1(tag_mode = "EXPLICIT")] @@ -296,7 +296,7 @@ impl fmt::Display for MissingRDCleanPathField { } } -impl std::error::Error for MissingRDCleanPathField {} +impl core::error::Error for MissingRDCleanPathField {} impl TryFrom for RDCleanPath { type Error = MissingRDCleanPathField; diff --git a/crates/ironrdp-rdpdr/src/pdu/mod.rs b/crates/ironrdp-rdpdr/src/pdu/mod.rs index ea65f578..ccca9be2 100644 --- a/crates/ironrdp-rdpdr/src/pdu/mod.rs +++ b/crates/ironrdp-rdpdr/src/pdu/mod.rs @@ -205,49 +205,49 @@ impl fmt::Debug for RdpdrPdu { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::VersionAndIdPdu(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientNameRequest(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::CoreCapability(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientDeviceListAnnounce(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ServerDeviceAnnounceResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceIoRequest(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceControlResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceCreateResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientDriveQueryInformationResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceCloseResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientDriveQueryDirectoryResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientDriveQueryVolumeInformationResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceReadResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::DeviceWriteResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::ClientDriveSetInformationResponse(it) => { - write!(f, "RdpdrPdu({:?})", it) + write!(f, "RdpdrPdu({it:?})") } Self::UserLoggedon => { write!(f, "RdpdrPdu(UserLoggedon)") diff --git a/crates/ironrdp-rdpsnd/src/server.rs b/crates/ironrdp-rdpsnd/src/server.rs index 61e16842..1e8103d4 100644 --- a/crates/ironrdp-rdpsnd/src/server.rs +++ b/crates/ironrdp-rdpsnd/src/server.rs @@ -8,9 +8,9 @@ use crate::pdu::{self, ClientAudioFormatPdu, QualityMode}; pub type RdpsndSvcMessages = SvcProcessorMessages; -pub trait RdpsndError: std::error::Error + Send + Sync + 'static {} +pub trait RdpsndError: core::error::Error + Send + Sync + 'static {} -impl RdpsndError for T where T: std::error::Error + Send + Sync + 'static {} +impl RdpsndError for T where T: core::error::Error + Send + Sync + 'static {} /// Message sent by the event loop. #[derive(Debug)] diff --git a/crates/ironrdp-replay-client/src/main.rs b/crates/ironrdp-replay-client/src/main.rs index 15050234..8c2e453c 100644 --- a/crates/ironrdp-replay-client/src/main.rs +++ b/crates/ironrdp-replay-client/src/main.rs @@ -16,7 +16,7 @@ use glutin::event_loop::ControlFlow; use ironrdp::pdu::dvc::gfx::{GraphicsPipelineError, ServerPdu}; use ironrdp_glutin_renderer::renderer::Renderer; -pub type Error = Box; +pub type Error = Box; /// Devolutions IronRDP client #[derive(Parser, Debug)] diff --git a/crates/ironrdp-server/src/builder.rs b/crates/ironrdp-server/src/builder.rs index 241ab2e3..876f95ab 100644 --- a/crates/ironrdp-server/src/builder.rs +++ b/crates/ironrdp-server/src/builder.rs @@ -1,4 +1,4 @@ -use std::net::SocketAddr; +use core::net::SocketAddr; use anyhow::Result; use tokio_rustls::TlsAcceptor; diff --git a/crates/ironrdp-server/src/server.rs b/crates/ironrdp-server/src/server.rs index 49fa849d..cf5df7cd 100644 --- a/crates/ironrdp-server/src/server.rs +++ b/crates/ironrdp-server/src/server.rs @@ -1,4 +1,4 @@ -use std::net::SocketAddr; +use core::net::SocketAddr; use std::rc::Rc; use std::sync::Arc; diff --git a/crates/ironrdp-session/src/lib.rs b/crates/ironrdp-session/src/lib.rs index eecd0b29..86d06153 100644 --- a/crates/ironrdp-session/src/lib.rs +++ b/crates/ironrdp-session/src/lib.rs @@ -47,8 +47,8 @@ impl fmt::Display for SessionErrorKind { } } -impl std::error::Error for SessionErrorKind { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for SessionErrorKind { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match &self { SessionErrorKind::Pdu(e) => Some(e), SessionErrorKind::Encode(e) => Some(e), @@ -70,7 +70,7 @@ pub trait SessionErrorExt { fn reason(context: &'static str, reason: impl Into) -> Self; fn custom(context: &'static str, e: E) -> Self where - E: std::error::Error + Sync + Send + 'static; + E: core::error::Error + Sync + Send + 'static; } impl SessionErrorExt for SessionError { @@ -96,7 +96,7 @@ impl SessionErrorExt for SessionError { fn custom(context: &'static str, e: E) -> Self where - E: std::error::Error + Sync + Send + 'static, + E: core::error::Error + Sync + Send + 'static, { Self::new(context, SessionErrorKind::Custom).with_source(e) } @@ -108,7 +108,7 @@ pub trait SessionResultExt { #[must_use] fn with_source(self, source: E) -> Self where - E: std::error::Error + Sync + Send + 'static; + E: core::error::Error + Sync + Send + 'static; } impl SessionResultExt for SessionResult { @@ -121,7 +121,7 @@ impl SessionResultExt for SessionResult { fn with_source(self, source: E) -> Self where - E: std::error::Error + Sync + Send + 'static, + E: core::error::Error + Sync + Send + 'static, { self.map_err(|e| e.with_source(source)) } diff --git a/crates/ironrdp-testsuite-core/tests/pdu/pointer.rs b/crates/ironrdp-testsuite-core/tests/pdu/pointer.rs index 883feeba..68728b15 100644 --- a/crates/ironrdp-testsuite-core/tests/pdu/pointer.rs +++ b/crates/ironrdp-testsuite-core/tests/pdu/pointer.rs @@ -23,7 +23,7 @@ fn expect_pointer_png(pointer: &DecodedPointer, expected_file_path: &str) { } if !std::path::Path::new(&path).exists() { - panic!("Test file {} does not exist", path); + panic!("Test file {path} does not exist"); } let png_buffer = std::fs::read(path).unwrap(); diff --git a/crates/ironrdp-tls/src/rustls.rs b/crates/ironrdp-tls/src/rustls.rs index 2f9bbc1b..10c8d8ab 100644 --- a/crates/ironrdp-tls/src/rustls.rs +++ b/crates/ironrdp-tls/src/rustls.rs @@ -41,7 +41,7 @@ where .1 .peer_certificates() .and_then(|certificates| certificates.first()) - .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "peer certificate is missing"))?; + .ok_or_else(|| io::Error::other("peer certificate is missing"))?; crate::extract_tls_server_public_key(cert)? }; diff --git a/crates/ironrdp-tokio/src/reqwest.rs b/crates/ironrdp-tokio/src/reqwest.rs index 07cae208..0a2c24d1 100644 --- a/crates/ironrdp-tokio/src/reqwest.rs +++ b/crates/ironrdp-tokio/src/reqwest.rs @@ -1,6 +1,6 @@ use core::future::Future; +use core::net::{IpAddr, Ipv4Addr}; use core::pin::Pin; -use std::net::{IpAddr, Ipv4Addr}; use ironrdp_connector::{custom_err, ConnectorResult}; use reqwest::Client; @@ -50,19 +50,19 @@ impl ReqwestNetworkClient { let mut stream = TcpStream::connect(addr) .await - .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e))) + .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}"))) .map_err(|e| custom_err!("failed to send KDC request over TCP", e))?; stream .write(data) .await - .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e))) + .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}"))) .map_err(|e| custom_err!("failed to send KDC request over TCP", e))?; let len = stream .read_u32() .await - .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e))) + .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}"))) .map_err(|e| custom_err!("failed to send KDC request over TCP", e))?; let mut buf = vec![0; len as usize + 4]; @@ -71,7 +71,7 @@ impl ReqwestNetworkClient { stream .read_exact(&mut buf[4..]) .await - .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e))) + .map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}"))) .map_err(|e| custom_err!("failed to send KDC request over TCP", e))?; Ok(buf) diff --git a/crates/ironrdp-web/src/session.rs b/crates/ironrdp-web/src/session.rs index e960e9c6..dc584258 100644 --- a/crates/ironrdp-web/src/session.rs +++ b/crates/ironrdp-web/src/session.rs @@ -1,8 +1,8 @@ use core::cell::RefCell; +use core::net::{Ipv4Addr, SocketAddrV4}; use core::num::NonZeroU32; use core::time::Duration; use std::borrow::Cow; -use std::net::{Ipv4Addr, SocketAddrV4}; use std::rc::Rc; use anyhow::Context as _; @@ -926,7 +926,7 @@ async fn connect( let mut framed = ironrdp_futures::LocalFuturesFramed::new(ws); // In web browser environments, we do not have an easy access to the local address of the socket. - let dummy_client_addr = std::net::SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 33899)); + let dummy_client_addr = core::net::SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 33899)); let mut connector = ClientConnector::new(config, dummy_client_addr); diff --git a/crates/ironrdp/examples/screenshot.rs b/crates/ironrdp/examples/screenshot.rs index abdbf605..21407933 100644 --- a/crates/ironrdp/examples/screenshot.rs +++ b/crates/ironrdp/examples/screenshot.rs @@ -302,7 +302,7 @@ fn active_stage( Ok(()) } -fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result { +fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result { use std::net::ToSocketAddrs as _; let addr = (hostname, port).to_socket_addrs()?.next().unwrap(); Ok(addr) diff --git a/crates/ironrdp/examples/server.rs b/crates/ironrdp/examples/server.rs index 873158b5..111b7c4f 100644 --- a/crates/ironrdp/examples/server.rs +++ b/crates/ironrdp/examples/server.rs @@ -6,8 +6,8 @@ #[macro_use] extern crate tracing; +use core::net::SocketAddr; use core::num::NonZeroU16; -use std::net::SocketAddr; use std::path::PathBuf; use std::sync::{Arc, Mutex}; diff --git a/ffi/build.rs b/ffi/build.rs index 6fa81007..eff43a38 100644 --- a/ffi/build.rs +++ b/ffi/build.rs @@ -15,9 +15,9 @@ mod win { fn generate_version_rc() -> String { let output_name = "DevolutionsIronRdp"; - let filename = format!("{}.dll", output_name); + let filename = format!("{output_name}.dll"); let company_name = "Devolutions Inc."; - let legal_copyright = format!("Copyright 2019-2024 {}", company_name); + let legal_copyright = format!("Copyright 2019-2024 {company_name}"); let mut cargo_version = env::var("CARGO_PKG_VERSION").unwrap(); cargo_version.push_str(".0"); @@ -67,17 +67,7 @@ BEGIN VALUE "Translation", 0x409, 1200 END END -"#, - vs_file_version = vs_file_version, - vs_product_version = vs_product_version, - company_name = company_name, - file_description = file_description, - file_version = file_version, - internal_name = internal_name, - legal_copyright = legal_copyright, - original_filename = original_filename, - product_name = product_name, - product_version = product_version +"# ); version_rc @@ -85,7 +75,7 @@ END pub(crate) fn main_stub() { let out_dir = env::var("OUT_DIR").unwrap(); - let version_rc_file = format!("{}/version.rc", out_dir); + let version_rc_file = format!("{out_dir}/version.rc"); let version_rc_data = generate_version_rc(); let mut file = File::create(&version_rc_file).expect("cannot create version.rc file"); file.write_all(version_rc_data.as_bytes()).unwrap(); diff --git a/ffi/src/connector/mod.rs b/ffi/src/connector/mod.rs index 2dcc53e6..bede9371 100644 --- a/ffi/src/connector/mod.rs +++ b/ffi/src/connector/mod.rs @@ -163,7 +163,7 @@ pub mod ffi { impl<'a> DynState<'a> { pub fn get_name(&'a self, writeable: &'a mut DiplomatWriteable) -> Result<(), Box> { let name = self.0.name(); - write!(writeable, "{}", name)?; + write!(writeable, "{name}")?; Ok(()) } diff --git a/ffi/src/credssp/network.rs b/ffi/src/credssp/network.rs index b2244c0e..4016ac76 100644 --- a/ffi/src/credssp/network.rs +++ b/ffi/src/credssp/network.rs @@ -97,7 +97,7 @@ pub mod ffi { pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box> { use core::fmt::Write; let url: &str = self.0.url.as_ref(); - write!(writeable, "{}", url)?; + write!(writeable, "{url}")?; Ok(()) } } diff --git a/ffi/src/error.rs b/ffi/src/error.rs index 96b5111c..9312ba45 100644 --- a/ffi/src/error.rs +++ b/ffi/src/error.rs @@ -257,7 +257,7 @@ impl WrongOSError { impl Display for WrongOSError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { if let Some(custom_message) = &self.custom_message { - write!(f, "{}", custom_message)?; + write!(f, "{custom_message}")?; } write!(f, "expected platform {}", self.expected) } diff --git a/ffi/src/log.rs b/ffi/src/log.rs index 6ee4e62e..c1c453df 100644 --- a/ffi/src/log.rs +++ b/ffi/src/log.rs @@ -1,4 +1,4 @@ -use std::error::Error; +use core::error::Error; use std::sync::Once; static INIT_LOG: Once = Once::new(); diff --git a/ffi/src/session/mod.rs b/ffi/src/session/mod.rs index 2e5404db..90153217 100644 --- a/ffi/src/session/mod.rs +++ b/ffi/src/session/mod.rs @@ -184,8 +184,8 @@ pub mod ffi { match &self.0 { ironrdp::session::ActiveStageOutput::ResponseFrame { .. } => ActiveStageOutputType::ResponseFrame, ironrdp::session::ActiveStageOutput::GraphicsUpdate { .. } => ActiveStageOutputType::GraphicsUpdate, - ironrdp::session::ActiveStageOutput::PointerDefault { .. } => ActiveStageOutputType::PointerDefault, - ironrdp::session::ActiveStageOutput::PointerHidden { .. } => ActiveStageOutputType::PointerHidden, + ironrdp::session::ActiveStageOutput::PointerDefault => ActiveStageOutputType::PointerDefault, + ironrdp::session::ActiveStageOutput::PointerHidden => ActiveStageOutputType::PointerHidden, ironrdp::session::ActiveStageOutput::PointerPosition { .. } => ActiveStageOutputType::PointerPosition, ironrdp::session::ActiveStageOutput::PointerBitmap { .. } => ActiveStageOutputType::PointerBitmap, ironrdp::session::ActiveStageOutput::Terminate { .. } => ActiveStageOutputType::Terminate, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b475f2f9..7855e6d5 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.85.0" +channel = "1.88.0" components = ["rustfmt", "clippy"] diff --git a/xtask/src/cov.rs b/xtask/src/cov.rs index 9db76501..6d663e7e 100644 --- a/xtask/src/cov.rs +++ b/xtask/src/cov.rs @@ -86,7 +86,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> { println!("Past:\n{past_report}"); println!("New:\n{report}"); - println!("Diff: {:+}%", diff); + println!("Diff: {diff:+}%"); // `GH_TOKEN` environment variable sanity checks match std::env::var_os("GH_TOKEN") { @@ -122,7 +122,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> { writeln!(body, "{COMMENT_HEADER}")?; writeln!(body, "**Past**:\n{past_report}")?; writeln!(body, "**New**:\n{report}")?; - writeln!(body, "**Diff**: {:+.2}%", diff)?; + writeln!(body, "**Diff**: {diff:+.2}%")?; writeln!(body, "\n[this comment will be updated automatically]")?; let command = cmd!(sh, "gh api") diff --git a/xtask/src/ffi.rs b/xtask/src/ffi.rs index 4ed3dff2..441e1f9f 100644 --- a/xtask/src/ffi.rs +++ b/xtask/src/ffi.rs @@ -120,7 +120,7 @@ fn remove_cs_files(dir: &Path) -> anyhow::Result<()> { let entry = entry?; let path = entry.path(); if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("cs") { - println!("Removing file: {:?}", path); + println!("Removing file: {path:?}"); fs::remove_file(path)?; } } diff --git a/xtask/src/web.rs b/xtask/src/web.rs index 50d11639..ee1795cd 100644 --- a/xtask/src/web.rs +++ b/xtask/src/web.rs @@ -62,10 +62,8 @@ pub fn build(sh: &Shell, wasm_pack_dev: bool) -> anyhow::Result<()> { // Modify the js file to get rid of the `URL` object. // Vite doesn't work properly with inlined urls in `new URL(url, import.meta.url)`. - let ironrdp_web_js_content = format!( - "import wasmUrl from './ironrdp_web_bg.wasm?url';\n\n{}", - ironrdp_web_js_content - ); + let ironrdp_web_js_content = + format!("import wasmUrl from './ironrdp_web_bg.wasm?url';\n\n{ironrdp_web_js_content}"); let ironrdp_web_js_content = ironrdp_web_js_content.replace("new URL('ironrdp_web_bg.wasm', import.meta.url)", "wasmUrl");