You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/rustc_lint/messages.ftl
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -615,7 +615,7 @@ lint_non_upper_case_global = {$sort} `{$name}` should have an upper case name
615
615
lint_noop_method_call = call to `.{$method}()` on a reference in this situation does nothing
616
616
.suggestion = remove this redundant call
617
617
.note = the type `{$orig_ty}` does not implement `{$trait_}`, so calling `{$method}` on `&{$orig_ty}` copies the reference, which does not do anything and can be removed
618
-
.derive_suggestion = if you meant to clone `{$orig_ty}`, implement `Clone` for it
618
+
.derive_suggestion = if you meant to clone `{$orig_ty}`, implement `Clone` for `{$non_clone_ty}`
619
619
620
620
lint_only_cast_u8_to_char = only `u8` can be cast into `char`
warning: call to `.clone()` on a reference in this situation does nothing
11
-
--> $DIR/noop-method-call.rs:17:21
11
+
--> $DIR/noop-method-call.rs:21:21
12
12
|
13
13
LL | let _ = &encoded.clone();
14
14
| ^^^^^^^^ help: remove this redundant call
15
15
|
16
16
= note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed
17
17
18
18
warning: call to `.clone()` on a reference in this situation does nothing
19
-
--> $DIR/noop-method-call.rs:23:71
19
+
--> $DIR/noop-method-call.rs:27:71
20
20
|
21
21
LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
22
22
| ^^^^^^^^
@@ -27,14 +27,14 @@ help: remove this redundant call
27
27
LL - let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
28
28
LL + let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref;
29
29
|
30
-
help: if you meant to clone `PlainType<u32>`, implement `Clone` for it
30
+
help: if you meant to clone `PlainType<u32>`, implement `Clone` for `PlainType<u32>`
31
31
|
32
32
LL + #[derive(Clone)]
33
33
LL | struct PlainType<T>(T);
34
34
|
35
35
36
36
warning: call to `.deref()` on a reference in this situation does nothing
37
-
--> $DIR/noop-method-call.rs:31:63
37
+
--> $DIR/noop-method-call.rs:35:63
38
38
|
39
39
LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
40
40
| ^^^^^^^^
@@ -45,14 +45,14 @@ help: remove this redundant call
45
45
LL - let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
46
46
LL + let non_deref_type_deref: &PlainType<u32> = non_deref_type;
47
47
|
48
-
help: if you meant to clone `PlainType<u32>`, implement `Clone` for it
48
+
help: if you meant to clone `PlainType<u32>`, implement `Clone` for `PlainType<u32>`
49
49
|
50
50
LL + #[derive(Clone)]
51
51
LL | struct PlainType<T>(T);
52
52
|
53
53
54
54
warning: call to `.borrow()` on a reference in this situation does nothing
55
-
--> $DIR/noop-method-call.rs:35:66
55
+
--> $DIR/noop-method-call.rs:39:66
56
56
|
57
57
LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
58
58
| ^^^^^^^^^
@@ -63,14 +63,14 @@ help: remove this redundant call
63
63
LL - let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
64
64
LL + let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type;
65
65
|
66
-
help: if you meant to clone `PlainType<u32>`, implement `Clone` for it
66
+
help: if you meant to clone `PlainType<u32>`, implement `Clone` for `PlainType<u32>`
67
67
|
68
68
LL + #[derive(Clone)]
69
69
LL | struct PlainType<T>(T);
70
70
|
71
71
72
72
warning: call to `.clone()` on a reference in this situation does nothing
73
-
--> $DIR/noop-method-call.rs:44:19
73
+
--> $DIR/noop-method-call.rs:48:19
74
74
|
75
75
LL | non_clone_type.clone();
76
76
| ^^^^^^^^
@@ -81,14 +81,14 @@ help: remove this redundant call
81
81
LL - non_clone_type.clone();
82
82
LL + non_clone_type;
83
83
|
84
-
help: if you meant to clone `PlainType<T>`, implement `Clone` for it
84
+
help: if you meant to clone `PlainType<T>`, implement `Clone` for `PlainType<T>`
85
85
|
86
86
LL + #[derive(Clone)]
87
87
LL | struct PlainType<T>(T);
88
88
|
89
89
90
90
warning: call to `.clone()` on a reference in this situation does nothing
91
-
--> $DIR/noop-method-call.rs:49:19
91
+
--> $DIR/noop-method-call.rs:53:19
92
92
|
93
93
LL | non_clone_type.clone();
94
94
| ^^^^^^^^
@@ -99,11 +99,63 @@ help: remove this redundant call
99
99
LL - non_clone_type.clone();
100
100
LL + non_clone_type;
101
101
|
102
-
help: if you meant to clone `PlainType<u32>`, implement `Clone` for it
102
+
help: if you meant to clone `PlainType<u32>`, implement `Clone` for `PlainType<u32>`
103
103
|
104
104
LL + #[derive(Clone)]
105
105
LL | struct PlainType<T>(T);
106
106
|
107
107
108
-
warning: 7 warnings emitted
108
+
warning: call to `.clone()` on a reference in this situation does nothing
109
+
--> $DIR/noop-method-call.rs:70:6
110
+
|
111
+
LL | v.clone();
112
+
| ^^^^^^^^ help: remove this redundant call
113
+
|
114
+
= note: the type `non_clone_types::NotClone` does not implement `Clone`, so calling `clone` on `&non_clone_types::NotClone` copies the reference, which does not do anything and can be removed
115
+
116
+
warning: call to `.clone()` on a reference in this situation does nothing
117
+
--> $DIR/noop-method-call.rs:75:6
118
+
|
119
+
LL | v.clone();
120
+
| ^^^^^^^^
121
+
|
122
+
= note: the type `non_clone_types::ConditionalClone<PlainType<u32>>` does not implement `Clone`, so calling `clone` on `&non_clone_types::ConditionalClone<PlainType<u32>>` copies the reference, which does not do anything and can be removed
123
+
help: remove this redundant call
124
+
|
125
+
LL - v.clone();
126
+
LL + v;
127
+
|
128
+
help: if you meant to clone `non_clone_types::ConditionalClone<PlainType<u32>>`, implement `Clone` for `PlainType<u32>`
129
+
|
130
+
LL + #[derive(Clone)]
131
+
LL | struct PlainType<T>(T);
132
+
|
133
+
134
+
warning: call to `.clone()` on a reference in this situation does nothing
135
+
--> $DIR/noop-method-call.rs:80:6
136
+
|
137
+
LL | v.clone();
138
+
| ^^^^^^^^ help: remove this redundant call
139
+
|
140
+
= note: the type `non_clone_types::ConditionalClone<non_clone_types::NotClone>` does not implement `Clone`, so calling `clone` on `&non_clone_types::ConditionalClone<non_clone_types::NotClone>` copies the reference, which does not do anything and can be removed
141
+
142
+
warning: call to `.clone()` on a reference in this situation does nothing
143
+
--> $DIR/noop-method-call.rs:89:6
144
+
|
145
+
LL | v.clone();
146
+
| ^^^^^^^^
147
+
|
148
+
= note: the type `non_clone_types::DifferentlyConditionalClone<PlainType<u8>>` does not implement `Clone`, so calling `clone` on `&non_clone_types::DifferentlyConditionalClone<PlainType<u8>>` copies the reference, which does not do anything and can be removed
149
+
help: remove this redundant call
150
+
|
151
+
LL - v.clone();
152
+
LL + v;
153
+
|
154
+
help: if you meant to clone `non_clone_types::DifferentlyConditionalClone<PlainType<u8>>`, implement `Clone` for `PlainType<u8>`
0 commit comments