about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-16 08:23:27 +0000
committerbors <bors@rust-lang.org>2020-11-16 08:23:27 +0000
commitdf3bb5881d27cd337011a714c74ff07fca59103c (patch)
treea3fe393ea3d6d00b9a3429759cd50497f7db8515
parentdb0464103e46b7f1bd44f0866ae88b0688da19b8 (diff)
parent0e803417f997ba35c0045704dd347e64c2a1786c (diff)
downloadrust-df3bb5881d27cd337011a714c74ff07fca59103c.tar.gz
rust-df3bb5881d27cd337011a714c74ff07fca59103c.zip
Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995
Rustup

changelog: none
-rw-r--r--clippy_lints/src/utils/sugg.rs1
-rw-r--r--tests/ui/cast_ref_to_mut.rs4
-rw-r--r--tests/ui/cast_ref_to_mut.stderr6
3 files changed, 8 insertions, 3 deletions
diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs
index 625120b880e..1fcd41e4dbf 100644
--- a/clippy_lints/src/utils/sugg.rs
+++ b/clippy_lints/src/utils/sugg.rs
@@ -170,6 +170,7 @@ impl<'a> Sugg<'a> {
             | ast::ExprKind::MacCall(..)
             | ast::ExprKind::MethodCall(..)
             | ast::ExprKind::Paren(..)
+            | ast::ExprKind::Underscore
             | ast::ExprKind::Path(..)
             | ast::ExprKind::Repeat(..)
             | ast::ExprKind::Ret(..)
diff --git a/tests/ui/cast_ref_to_mut.rs b/tests/ui/cast_ref_to_mut.rs
index 089e5cfabe4..0ede958d170 100644
--- a/tests/ui/cast_ref_to_mut.rs
+++ b/tests/ui/cast_ref_to_mut.rs
@@ -2,6 +2,10 @@
 #![allow(clippy::no_effect)]
 
 extern "C" {
+    #[rustfmt::skip]
+    // TODO: This `rustfmt::skip` is a work around of #6336 because
+    // the following comments are checked by rustfmt for some reason.
+    //
     // N.B., mutability can be easily incorrect in FFI calls -- as
     // in C, the default is mutable pointers.
     fn ffi(c: *mut u8);
diff --git a/tests/ui/cast_ref_to_mut.stderr b/tests/ui/cast_ref_to_mut.stderr
index aacd99437d9..d36aa0e00ee 100644
--- a/tests/ui/cast_ref_to_mut.stderr
+++ b/tests/ui/cast_ref_to_mut.stderr
@@ -1,5 +1,5 @@
 error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
-  --> $DIR/cast_ref_to_mut.rs:18:9
+  --> $DIR/cast_ref_to_mut.rs:22:9
    |
 LL |         (*(a as *const _ as *mut String)).push_str(" world");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,13 +7,13 @@ LL |         (*(a as *const _ as *mut String)).push_str(" world");
    = note: `-D clippy::cast-ref-to-mut` implied by `-D warnings`
 
 error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
-  --> $DIR/cast_ref_to_mut.rs:19:9
+  --> $DIR/cast_ref_to_mut.rs:23:9
    |
 LL |         *(a as *const _ as *mut _) = String::from("Replaced");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
-  --> $DIR/cast_ref_to_mut.rs:20:9
+  --> $DIR/cast_ref_to_mut.rs:24:9
    |
 LL |         *(a as *const _ as *mut String) += " world";
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^