chore: update Rust toolchain to 1.88.0 (#852)

MSRV is also bumped to 1.84.
This commit is contained in:
Benoît Cortier 2025-07-03 00:38:28 -04:00 committed by GitHub
parent eca256ae10
commit 48e02441d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 122 additions and 140 deletions

View file

@ -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),

View file

@ -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

View file

@ -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<Bytes> {
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 {

View file

@ -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;

View file

@ -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<Bytes> {
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 {

View file

@ -85,12 +85,12 @@ impl Destination {
let addr = addr.into();
if let Some(idx) = addr.rfind(':') {
if let Ok(sock_addr) = addr.parse::<std::net::SocketAddr>() {
if let Ok(sock_addr) = addr.parse::<core::net::SocketAddr>() {
Ok(Self {
name: sock_addr.ip().to_string(),
port: sock_addr.port(),
})
} else if addr.parse::<std::net::Ipv6Addr>().is_ok() {
} else if addr.parse::<core::net::Ipv6Addr>().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);
}
};

View file

@ -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

View file

@ -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<T> ClipboardError for T where T: std::error::Error + Send + Sync + 'static {}
impl<T> ClipboardError for T where T: core::error::Error + Send + Sync + 'static {}
/// Message sent by the OS clipboard backend event loop.
#[derive(Debug)]

View file

@ -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

View file

@ -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<String>) -> Self;
fn custom<E>(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<E>(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<E>(self, source: E) -> Self
where
E: std::error::Error + Sync + Send + 'static;
E: core::error::Error + Sync + Send + 'static;
}
impl<T> ConnectorResultExt for ConnectorResult<T> {
@ -362,7 +362,7 @@ impl<T> ConnectorResultExt for ConnectorResult<T> {
fn with_source<E>(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))
}

View file

@ -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::<std::net::SocketAddr>() {
if let Ok(sock_addr) = name.parse::<core::net::SocketAddr>() {
// A socket address, including a port
sock_addr.ip().to_string()
} else if name.parse::<std::net::Ipv6Addr>().is_ok() {
} else if name.parse::<core::net::Ipv6Addr>().is_ok() {
// An IPv6 address with no port, do not include a port, already sane
name
} else {

View file

@ -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) => {{

View file

@ -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 {

View file

@ -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 {

View file

@ -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}`"),
}
}
}

View file

@ -272,7 +272,7 @@ impl fmt::Display for Cmd {
impl From<Cmd> for String {
fn from(cmd: Cmd) -> Self {
format!("{:?}", cmd)
format!("{cmd:?}")
}
}

View file

@ -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<T> Source for T where T: std::error::Error + Sync + Send + 'static {}
impl<T> 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<Kind> {
pub context: &'static str,
pub kind: Kind,
#[cfg(feature = "std")]
source: Option<Box<dyn std::error::Error + Sync + Send>>,
source: Option<Box<dyn core::error::Error + Sync + Send>>,
#[cfg(all(not(feature = "std"), feature = "alloc"))]
source: Option<Box<dyn Source>>,
}
@ -94,11 +94,11 @@ where
}
#[cfg(feature = "std")]
impl<Kind> std::error::Error for Error<Kind>
impl<Kind> core::error::Error for Error<Kind>
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<Kind> From<Error<Kind>> for std::io::Error
where
Kind: std::error::Error + Send + Sync + 'static,
Kind: core::error::Error + Send + Sync + 'static,
{
fn from(error: Error<Kind>) -> Self {
Self::new(std::io::ErrorKind::Other, error)
Self::other(error)
}
}
@ -127,10 +127,10 @@ pub struct ErrorReport<'a, Kind>(&'a Error<Kind>);
#[cfg(feature = "std")]
impl<Kind> 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)?;

View file

@ -11,5 +11,5 @@ pub mod renderer;
mod draw;
mod surface;
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
type Error = Box<dyn core::error::Error + Send + Sync + 'static>;
type Result<T> = std::result::Result<T, Error>;

View file

@ -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.

View file

@ -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)
};

View file

@ -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 cant 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 dont 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,

View file

@ -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,

View file

@ -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 {

View file

@ -1180,7 +1180,7 @@ mod legacy {
impl From<McsError> 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}"))
}
}
}

View file

@ -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())?;

View file

@ -112,6 +112,6 @@ impl From<PduError> for RdpError {
impl From<RdpError> 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}"))
}
}

View file

@ -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<BitmapCodecs, Strin
let state = match state_str {
"on" => 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::<Vec<_>>().join(", ");
if !codec_names.is_empty() {
return Err(format!("Unknown codecs: {}", codec_names));
return Err(format!("Unknown codecs: {codec_names}"));
}
Ok(BitmapCodecs(codecs))

View file

@ -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
///

View file

@ -111,6 +111,6 @@ impl From<PduError> for ChannelError {
impl From<ChannelError> 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}"))
}
}

View file

@ -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(),
}
}

View file

@ -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<RDCleanPathPdu> for RDCleanPath {
type Error = MissingRDCleanPathField;

View file

@ -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)")

View file

@ -8,9 +8,9 @@ use crate::pdu::{self, ClientAudioFormatPdu, QualityMode};
pub type RdpsndSvcMessages = SvcProcessorMessages<RdpsndServer>;
pub trait RdpsndError: std::error::Error + Send + Sync + 'static {}
pub trait RdpsndError: core::error::Error + Send + Sync + 'static {}
impl<T> RdpsndError for T where T: std::error::Error + Send + Sync + 'static {}
impl<T> RdpsndError for T where T: core::error::Error + Send + Sync + 'static {}
/// Message sent by the event loop.
#[derive(Debug)]

View file

@ -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<dyn std::error::Error + Send + Sync + 'static>;
pub type Error = Box<dyn core::error::Error + Send + Sync + 'static>;
/// Devolutions IronRDP client
#[derive(Parser, Debug)]

View file

@ -1,4 +1,4 @@
use std::net::SocketAddr;
use core::net::SocketAddr;
use anyhow::Result;
use tokio_rustls::TlsAcceptor;

View file

@ -1,4 +1,4 @@
use std::net::SocketAddr;
use core::net::SocketAddr;
use std::rc::Rc;
use std::sync::Arc;

View file

@ -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<String>) -> Self;
fn custom<E>(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<E>(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<E>(self, source: E) -> Self
where
E: std::error::Error + Sync + Send + 'static;
E: core::error::Error + Sync + Send + 'static;
}
impl<T> SessionResultExt for SessionResult<T> {
@ -121,7 +121,7 @@ impl<T> SessionResultExt for SessionResult<T> {
fn with_source<E>(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))
}

View file

@ -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();

View file

@ -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)?
};

View file

@ -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)

View file

@ -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);

View file

@ -302,7 +302,7 @@ fn active_stage(
Ok(())
}
fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result<std::net::SocketAddr> {
fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result<core::net::SocketAddr> {
use std::net::ToSocketAddrs as _;
let addr = (hostname, port).to_socket_addrs()?.next().unwrap();
Ok(addr)

View file

@ -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};

View file

@ -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();

View file

@ -163,7 +163,7 @@ pub mod ffi {
impl<'a> DynState<'a> {
pub fn get_name(&'a self, writeable: &'a mut DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
let name = self.0.name();
write!(writeable, "{}", name)?;
write!(writeable, "{name}")?;
Ok(())
}

View file

@ -97,7 +97,7 @@ pub mod ffi {
pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
use core::fmt::Write;
let url: &str = self.0.url.as_ref();
write!(writeable, "{}", url)?;
write!(writeable, "{url}")?;
Ok(())
}
}

View file

@ -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)
}

View file

@ -1,4 +1,4 @@
use std::error::Error;
use core::error::Error;
use std::sync::Once;
static INIT_LOG: Once = Once::new();

View file

@ -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,

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.85.0"
channel = "1.88.0"
components = ["rustfmt", "clippy"]

View file

@ -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")

View file

@ -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)?;
}
}

View file

@ -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");