-
Notifications
You must be signed in to change notification settings - Fork 977
Open
Labels
needs-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.This issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.
Description
Tuples or methods with two unsafe blocks are formatted as follows:
let (n, m) = (unsafe { NonZeroU16::new_unchecked(u16::MAX) }, unsafe {
NonZeroU16::new_unchecked(u16::MAX)
});
let r = NonZeroU16::div_ceil(unsafe { NonZeroU16::new_unchecked(u16::MAX) }, unsafe {
NonZeroU16::new_unchecked(u16::MAX)
});I think this is ugly.
Similar code without unsafe blocks would be formatted as follows:
let (n, m) = (
NonZeroU16::new(u16::MAX).unwrap(),
NonZeroU16::new(u16::MAX).unwrap(),
);
let r = NonZeroU16::div_ceil(
NonZeroU16::new(u16::MAX).unwrap(),
NonZeroU16::new(u16::MAX).unwrap(),
);Similar to this, I think the first example should be formatted like this:
let (n, m) = (
unsafe { NonZeroU16::new_unchecked(u16::MAX) },
unsafe { NonZeroU16::new_unchecked(u16::MAX) },
);
let r = NonZeroU16::div_ceil(
unsafe { NonZeroU16::new_unchecked(u16::MAX) },
unsafe { NonZeroU16::new_unchecked(u16::MAX) },
);$ rustfmt --version
rustfmt 1.8.0-nightly (fabece9e94 2025-12-25)Metadata
Metadata
Assignees
Labels
needs-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.This issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.