Fix example
This commit is contained in:
parent
169ef781f9
commit
2b944d0c38
@ -608,13 +608,13 @@ declare_clippy_lint! {
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
/// let string = String::with_capacity(1);
|
||||
/// let ptr = string.as_ptr() as *mut _;
|
||||
/// let ptr = string.as_ptr() as *mut u8;
|
||||
/// unsafe { ptr.write(4) }; // UNDEFINED BEHAVIOUR
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust
|
||||
/// let mut string = String::with_capacity(1);
|
||||
/// let string = string.as_mut_ptr();
|
||||
/// let ptr = string.as_mut_ptr();
|
||||
/// unsafe { ptr.write(4) };
|
||||
/// ```
|
||||
#[clippy::version = "1.66.0"]
|
||||
|
@ -8,12 +8,12 @@ mutability is used, making it unlikely that having it as a mutable pointer is co
|
||||
### Example
|
||||
```
|
||||
let string = String::with_capacity(1);
|
||||
let ptr = string.as_ptr() as *mut _;
|
||||
let ptr = string.as_ptr() as *mut u8;
|
||||
unsafe { ptr.write(4) }; // UNDEFINED BEHAVIOUR
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let mut string = String::with_capacity(1);
|
||||
let string = string.as_mut_ptr();
|
||||
let ptr = string.as_mut_ptr();
|
||||
unsafe { ptr.write(4) };
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user