Skip to content

Commit 6cdb7f6

Browse files
authored
allow assign_op_pattern in the test of string_add (#14143)
Since `assign_op_pattern` is a style lint, not explicitly allowing it can lead to undesirable output in other lint checks. changelog: none
2 parents 0ff9540 + 4220dbd commit 6cdb7f6

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

tests/ui/string_add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate proc_macros;
44
use proc_macros::external;
55

66
#[warn(clippy::string_add)]
7-
#[allow(clippy::string_add_assign, unused)]
7+
#[allow(clippy::assign_op_pattern, clippy::string_add_assign, unused)]
88
fn main() {
99
// ignores assignment distinction
1010
let mut x = String::new();

tests/ui/string_add.stderr

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
error: manual implementation of an assign operation
2-
--> tests/ui/string_add.rs:13:9
3-
|
4-
LL | x = x + ".";
5-
| ^^^^^^^^^^^ help: replace it with: `x += "."`
6-
|
7-
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
8-
= help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]`
9-
101
error: you added something to a string. Consider using `String::push_str()` instead
112
--> tests/ui/string_add.rs:13:13
123
|
@@ -22,11 +13,5 @@ error: you added something to a string. Consider using `String::push_str()` inst
2213
LL | let z = y + "...";
2314
| ^^^^^^^^^
2415

25-
error: manual implementation of an assign operation
26-
--> tests/ui/string_add.rs:22:5
27-
|
28-
LL | x = x + 1;
29-
| ^^^^^^^^^ help: replace it with: `x += 1`
30-
31-
error: aborting due to 4 previous errors
16+
error: aborting due to 2 previous errors
3217

0 commit comments

Comments
 (0)