Skip to content

Commit df3bb58

Browse files
committed
Auto merge of rust-lang#6336 - giraffate:sync-from-rust, r=flip1995
Rustup changelog: none
2 parents db04641 + 0e80341 commit df3bb58

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

clippy_lints/src/utils/sugg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl<'a> Sugg<'a> {
170170
| ast::ExprKind::MacCall(..)
171171
| ast::ExprKind::MethodCall(..)
172172
| ast::ExprKind::Paren(..)
173+
| ast::ExprKind::Underscore
173174
| ast::ExprKind::Path(..)
174175
| ast::ExprKind::Repeat(..)
175176
| ast::ExprKind::Ret(..)

tests/ui/cast_ref_to_mut.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#![allow(clippy::no_effect)]
33

44
extern "C" {
5+
#[rustfmt::skip]
6+
// TODO: This `rustfmt::skip` is a work around of #6336 because
7+
// the following comments are checked by rustfmt for some reason.
8+
//
59
// N.B., mutability can be easily incorrect in FFI calls -- as
610
// in C, the default is mutable pointers.
711
fn ffi(c: *mut u8);

tests/ui/cast_ref_to_mut.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
2-
--> $DIR/cast_ref_to_mut.rs:18:9
2+
--> $DIR/cast_ref_to_mut.rs:22:9
33
|
44
LL | (*(a as *const _ as *mut String)).push_str(" world");
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::cast-ref-to-mut` implied by `-D warnings`
88

99
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
10-
--> $DIR/cast_ref_to_mut.rs:19:9
10+
--> $DIR/cast_ref_to_mut.rs:23:9
1111
|
1212
LL | *(a as *const _ as *mut _) = String::from("Replaced");
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

1515
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
16-
--> $DIR/cast_ref_to_mut.rs:20:9
16+
--> $DIR/cast_ref_to_mut.rs:24:9
1717
|
1818
LL | *(a as *const _ as *mut String) += " world";
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)