-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Restrict same_item_push
to suppress false positives
#6016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d30ef7
Restrict `same_item_push` to suppress false positives
giraffate 619ca76
Refactoring: use inner function
giraffate 5d085ad
Some refactoring
giraffate 2c9f82e
Add some tests to `same_item_push`
giraffate 952c046
Refactoring: tests in `same_item_push`
giraffate 1d8ae3a
Address `items_after_statement`
giraffate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
error: it looks like the same item is being pushed into this Vec | ||
--> $DIR/same_item_push.rs:16:9 | ||
--> $DIR/same_item_push.rs:23:9 | ||
| | ||
LL | spaces.push(vec![b' ']); | ||
| ^^^^^^ | ||
LL | vec.push(item); | ||
| ^^^ | ||
| | ||
= note: `-D clippy::same-item-push` implied by `-D warnings` | ||
= help: try using vec![vec![b' '];SIZE] or spaces.resize(NEW_SIZE, vec![b' ']) | ||
= help: try using vec![item;SIZE] or vec.resize(NEW_SIZE, item) | ||
|
||
error: it looks like the same item is being pushed into this Vec | ||
--> $DIR/same_item_push.rs:22:9 | ||
--> $DIR/same_item_push.rs:29:9 | ||
| | ||
LL | vec2.push(item); | ||
| ^^^^ | ||
LL | vec.push(item); | ||
| ^^^ | ||
| | ||
= help: try using vec![item;SIZE] or vec2.resize(NEW_SIZE, item) | ||
= help: try using vec![item;SIZE] or vec.resize(NEW_SIZE, item) | ||
|
||
error: it looks like the same item is being pushed into this Vec | ||
--> $DIR/same_item_push.rs:28:9 | ||
--> $DIR/same_item_push.rs:34:9 | ||
| | ||
LL | vec3.push(item); | ||
| ^^^^ | ||
LL | vec.push(13); | ||
| ^^^ | ||
| | ||
= help: try using vec![item;SIZE] or vec3.resize(NEW_SIZE, item) | ||
= help: try using vec![13;SIZE] or vec.resize(NEW_SIZE, 13) | ||
|
||
error: it looks like the same item is being pushed into this Vec | ||
--> $DIR/same_item_push.rs:33:9 | ||
--> $DIR/same_item_push.rs:39:9 | ||
| | ||
LL | vec4.push(13); | ||
| ^^^^ | ||
LL | vec.push(VALUE); | ||
| ^^^ | ||
| | ||
= help: try using vec![13;SIZE] or vec4.resize(NEW_SIZE, 13) | ||
= help: try using vec![VALUE;SIZE] or vec.resize(NEW_SIZE, VALUE) | ||
|
||
error: aborting due to 4 previous errors | ||
error: it looks like the same item is being pushed into this Vec | ||
--> $DIR/same_item_push.rs:45:9 | ||
| | ||
LL | vec.push(item); | ||
| ^^^ | ||
| | ||
= help: try using vec![item;SIZE] or vec.resize(NEW_SIZE, item) | ||
|
||
error: aborting due to 5 previous errors | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.