summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/suspicious-double-ref-op.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/ui/lint/suspicious-double-ref-op.stderr
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/suspicious-double-ref-op.stderr')
-rw-r--r--tests/ui/lint/suspicious-double-ref-op.stderr33
1 files changed, 15 insertions, 18 deletions
diff --git a/tests/ui/lint/suspicious-double-ref-op.stderr b/tests/ui/lint/suspicious-double-ref-op.stderr
index d15487ca2..f5a71d40f 100644
--- a/tests/ui/lint/suspicious-double-ref-op.stderr
+++ b/tests/ui/lint/suspicious-double-ref-op.stderr
@@ -1,5 +1,5 @@
error: using `.clone()` on a double reference, which returns `&Vec<i32>` instead of cloning the inner type
- --> $DIR/suspicious-double-ref-op.rs:7:23
+ --> $DIR/suspicious-double-ref-op.rs:15:23
|
LL | let z: &Vec<_> = y.clone();
| ^^^^^^^^
@@ -10,26 +10,23 @@ note: the lint level is defined here
LL | #![deny(suspicious_double_ref_op, noop_method_call)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/suspicious-double-ref-op.rs:24:25
+error: using `.clone()` on a double reference, which returns `&CloneType<u32>` instead of cloning the inner type
+ --> $DIR/suspicious-double-ref-op.rs:33:63
|
-LL | let _ = &mut encoded.clone();
- | ^^^^^^^^ unnecessary method call
- |
- = note: the type `&[u8]` 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/suspicious-double-ref-op.rs:2:35
- |
-LL | #![deny(suspicious_double_ref_op, noop_method_call)]
- | ^^^^^^^^^^^^^^^^
+LL | let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
+ | ^^^^^^^^
-error: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/suspicious-double-ref-op.rs:26:21
+error: using `.deref()` on a double reference, which returns `&PlainType<u32>` instead of dereferencing the inner type
+ --> $DIR/suspicious-double-ref-op.rs:37:63
|
-LL | let _ = &encoded.clone();
- | ^^^^^^^^ unnecessary method call
+LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
+ | ^^^^^^^^
+
+error: using `.clone()` on a double reference, which returns `&str` instead of cloning the inner type
+ --> $DIR/suspicious-double-ref-op.rs:41:44
|
- = note: the type `&[u8]` 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
+LL | let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
+ | ^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors