Skip to content

Commit eb5d4b7

Browse files
committed
Auto merge of #13390 - samueltardieu:push-qqtuttutxpmv, r=xFrednet
Make it clearer that the suggestion is an alternative one `needless_pass_by_value` sometimes suggest marking the concerned type as `Copy`. Adding a `or` before this suggestion makes it clearer that this is not the second part of the original suggestion, but an alternative one. Inspired by a misunderstanding in #13321 changelog: none
2 parents e039e72 + 6371b30 commit eb5d4b7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
208208
)
209209
.is_ok()
210210
{
211-
diag.span_help(span, "consider marking this type as `Copy`");
211+
diag.span_help(span, "or consider marking this type as `Copy`");
212212
}
213213
}
214214
}

tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this argument is passed by value, but not consumed in the function body
44
LL | fn test(x: Foo<'_>) {}
55
| ^^^^^^^ help: consider taking a reference instead: `&Foo<'_>`
66
|
7-
help: consider marking this type as `Copy`
7+
help: or consider marking this type as `Copy`
88
--> tests/ui/crashes/needless_pass_by_value-w-late-bound.rs:5:1
99
|
1010
LL | struct Foo<'a>(&'a [(); 100]);

tests/ui/needless_pass_by_value.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ error: this argument is passed by value, but not consumed in the function body
121121
LL | fn bar_copy(x: u32, y: CopyWrapper) {
122122
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
123123
|
124-
help: consider marking this type as `Copy`
124+
help: or consider marking this type as `Copy`
125125
--> tests/ui/needless_pass_by_value.rs:141:1
126126
|
127127
LL | struct CopyWrapper(u32);
@@ -133,7 +133,7 @@ error: this argument is passed by value, but not consumed in the function body
133133
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
134134
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
135135
|
136-
help: consider marking this type as `Copy`
136+
help: or consider marking this type as `Copy`
137137
--> tests/ui/needless_pass_by_value.rs:141:1
138138
|
139139
LL | struct CopyWrapper(u32);
@@ -145,7 +145,7 @@ error: this argument is passed by value, but not consumed in the function body
145145
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
146146
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
147147
|
148-
help: consider marking this type as `Copy`
148+
help: or consider marking this type as `Copy`
149149
--> tests/ui/needless_pass_by_value.rs:141:1
150150
|
151151
LL | struct CopyWrapper(u32);
@@ -157,7 +157,7 @@ error: this argument is passed by value, but not consumed in the function body
157157
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
158158
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
159159
|
160-
help: consider marking this type as `Copy`
160+
help: or consider marking this type as `Copy`
161161
--> tests/ui/needless_pass_by_value.rs:141:1
162162
|
163163
LL | struct CopyWrapper(u32);

0 commit comments

Comments
 (0)