We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
as_ptr_cast_mut
1 parent 3b5b2ed commit 8f979afCopy full SHA for 8f979af
clippy_lints/src/casts/mod.rs
@@ -625,14 +625,14 @@ declare_clippy_lint! {
625
///
626
/// ### Example
627
/// ```rust
628
- /// let string = String::with_capacity(1);
629
- /// let ptr = string.as_ptr() as *mut u8;
+ /// let mut vec = Vec::<u8>::with_capacity(1);
+ /// let ptr = vec.as_ptr() as *mut u8;
630
/// unsafe { ptr.write(4) }; // UNDEFINED BEHAVIOUR
631
/// ```
632
/// Use instead:
633
634
- /// let mut string = String::with_capacity(1);
635
- /// let ptr = string.as_mut_ptr();
+ /// let ptr = vec.as_mut_ptr();
636
/// unsafe { ptr.write(4) };
637
638
#[clippy::version = "1.66.0"]
0 commit comments