rustfmt
rustfmt copied to clipboard
`wrap_comments` sometimes breaks code blocks in lists
With rustfmt 1.5.2-nightly (88fb1b92 2023-04-10)
:
Input code
Snippet from some internal documentation I'm writing:
//! - References?
//! - Unsound. See this example:
//! ```compile_fail
//! # use core::mem::MaybeUninit;
//! let mut a = 0;
//! let b = maybe_uninit_ext::new::<&mut MaybeUninit<u8>>(&mut a);
//! *b = maybe_uninit_ext::uninit();
//! assert_eq!(a, 0); // undefined behavior! a is uninitialized.
//! ```
//! Due to interior mutability, this is an issue for immutable references
//! as well.
Actual result
//! - References?
//! - Unsound. See this example: ```compile_fail # use core::mem::MaybeUninit;
//! let mut a = 0; let b = maybe_uninit_ext::new::<&mut
//! MaybeUninit<u8>>(&mut a); *b = maybe_uninit_ext::uninit(); assert_eq!(a,
//! 0); // undefined behavior! a is uninitialized. ``` Due to interior
//! mutability, this is an issue for immutable references as well.
Expected result
The code block should be preserved.