about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2023-05-24 16:05:42 +0000
committerDeadbeef <ent3rm4n@gmail.com>2023-07-23 07:09:14 +0000
commit33ec4e4bb0e332072b5dbd31f8f024dff4e3f44e (patch)
tree80448358741f8236781db361d1187ddb83c33e53 /tests
parentcec34a43b1b14f4e39363f3b283d7ac4f593ee81 (diff)
downloadrust-33ec4e4bb0e332072b5dbd31f8f024dff4e3f44e.tar.gz
rust-33ec4e4bb0e332072b5dbd31f8f024dff4e3f44e.zip
make `noop_method_call` warn by default
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/issues/issue-11820.rs2
-rw-r--r--tests/ui/lint/noop-method-call.rs1
-rw-r--r--tests/ui/lint/noop-method-call.stderr22
-rw-r--r--tests/ui/underscore-imports/cycle.rs2
-rw-r--r--tests/ui/underscore-imports/hygiene.rs1
5 files changed, 14 insertions, 14 deletions
diff --git a/tests/ui/issues/issue-11820.rs b/tests/ui/issues/issue-11820.rs
index 7ffe9652797..dc6349b10ee 100644
--- a/tests/ui/issues/issue-11820.rs
+++ b/tests/ui/issues/issue-11820.rs
@@ -1,6 +1,8 @@
 // run-pass
 // pretty-expanded FIXME #23616
 
+#![allow(noop_method_call)]
+
 struct NoClone;
 
 fn main() {
diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs
index dbcf2a5131b..8ce6c859b24 100644
--- a/tests/ui/lint/noop-method-call.rs
+++ b/tests/ui/lint/noop-method-call.rs
@@ -1,7 +1,6 @@
 // check-pass
 
 #![allow(unused)]
-#![warn(noop_method_call)]
 
 use std::borrow::Borrow;
 use std::ops::Deref;
diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr
index 37cd1a0fc18..ae61913f993 100644
--- a/tests/ui/lint/noop-method-call.stderr
+++ b/tests/ui/lint/noop-method-call.stderr
@@ -1,18 +1,14 @@
 warning: call to `.clone()` on a reference in this situation does nothing
-  --> $DIR/noop-method-call.rs:16:71
+  --> $DIR/noop-method-call.rs:15:71
    |
 LL |     let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
    |                                                                       ^^^^^^^^ unnecessary method call
    |
    = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
-note: the lint level is defined here
-  --> $DIR/noop-method-call.rs:4:9
-   |
-LL | #![warn(noop_method_call)]
-   |         ^^^^^^^^^^^^^^^^
+   = note: `#[warn(noop_method_call)]` on by default
 
 warning: using `.clone()` on a double reference, which returns `&CloneType<u32>` instead of cloning the inner type
-  --> $DIR/noop-method-call.rs:23:63
+  --> $DIR/noop-method-call.rs:22:63
    |
 LL |     let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
    |                                                               ^^^^^^^^
@@ -20,7 +16,7 @@ LL |     let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
    = note: `#[warn(suspicious_double_ref_op)]` on by default
 
 warning: call to `.deref()` on a reference in this situation does nothing
-  --> $DIR/noop-method-call.rs:27:63
+  --> $DIR/noop-method-call.rs:26:63
    |
 LL |     let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
    |                                                               ^^^^^^^^ unnecessary method call
@@ -28,13 +24,13 @@ LL |     let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
    = note: the type `&PlainType<u32>` which `deref` is being called on is the same as the type returned from `deref`, so the method call does not do anything and can be removed
 
 warning: using `.deref()` on a double reference, which returns `&PlainType<u32>` instead of dereferencing the inner type
-  --> $DIR/noop-method-call.rs:31:63
+  --> $DIR/noop-method-call.rs:30:63
    |
 LL |     let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
    |                                                               ^^^^^^^^
 
 warning: call to `.borrow()` on a reference in this situation does nothing
-  --> $DIR/noop-method-call.rs:35:66
+  --> $DIR/noop-method-call.rs:34:66
    |
 LL |     let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
    |                                                                  ^^^^^^^^^ unnecessary method call
@@ -42,13 +38,13 @@ LL |     let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
    = note: the type `&PlainType<u32>` which `borrow` is being called on is the same as the type returned from `borrow`, so the method call does not do anything and can be removed
 
 warning: using `.clone()` on a double reference, which returns `&str` instead of cloning the inner type
-  --> $DIR/noop-method-call.rs:43:44
+  --> $DIR/noop-method-call.rs:42:44
    |
 LL |     let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
    |                                            ^^^^^^^^
 
 warning: call to `.clone()` on a reference in this situation does nothing
-  --> $DIR/noop-method-call.rs:48:19
+  --> $DIR/noop-method-call.rs:47:19
    |
 LL |     non_clone_type.clone();
    |                   ^^^^^^^^ unnecessary method call
@@ -56,7 +52,7 @@ LL |     non_clone_type.clone();
    = note: the type `&PlainType<T>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
 
 warning: call to `.clone()` on a reference in this situation does nothing
-  --> $DIR/noop-method-call.rs:53:19
+  --> $DIR/noop-method-call.rs:52:19
    |
 LL |     non_clone_type.clone();
    |                   ^^^^^^^^ unnecessary method call
diff --git a/tests/ui/underscore-imports/cycle.rs b/tests/ui/underscore-imports/cycle.rs
index bacf9b2d5a9..c8a29368787 100644
--- a/tests/ui/underscore-imports/cycle.rs
+++ b/tests/ui/underscore-imports/cycle.rs
@@ -2,6 +2,8 @@
 
 // check-pass
 
+#![allow(noop_method_call)]
+
 mod x {
     pub use crate::y::*;
     pub use std::ops::Deref as _;
diff --git a/tests/ui/underscore-imports/hygiene.rs b/tests/ui/underscore-imports/hygiene.rs
index c4db6524538..7795ccb7971 100644
--- a/tests/ui/underscore-imports/hygiene.rs
+++ b/tests/ui/underscore-imports/hygiene.rs
@@ -3,6 +3,7 @@
 // check-pass
 
 #![feature(decl_macro)]
+#![allow(noop_method_call)]
 
 mod x {
     pub use std::ops::Deref as _;