-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
unnecessary_owned_empty_strings
#8660
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
I need to do an additional check which does not currently run due to pulling from source and |
Seems like this currently does not catch |
I wouldn't try to handle |
Got it, thanks for the tip @Jarcho! |
The discussion on Reddit brought up that you may want to use Making sure that these aren't issues that should prevent this lint from being added |
Irrelevant in this case. This lint is for any time a |
Tested on a bunch of crates. 3 warnings in yaml-rust. Fix worked.
|
r? @flip1995 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, impl LGTM, just 2 more NITs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, please squash your commits, so we can merge this 🚀
Done |
@bors r+ Thanks! |
📌 Commit a4d1837 has been approved by |
`unnecessary_owned_empty_string` [`unnecessary_owned_empty_string`] Fixes #8650 - \[x] Followed [lint naming conventions][lint_naming] - \[x] Added passing UI tests (including committed `.stderr` file) - \[x] `cargo test` passes locally - \[x] Executed `cargo dev update_lints` - \[x] Added lint documentation - \[x] Run `cargo dev fmt` [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints changelog: Adds `unnecessary_owned_empty_string`, a lint that detects passing owned empty strings to a function expecting `&str`
@bors r- retry |
/// vec!["1", "2", "3"].join(""); | ||
/// ``` | ||
#[clippy::version = "1.62.0"] | ||
pub UNNECESSARY_OWNED_EMPTY_STRING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub UNNECESSARY_OWNED_EMPTY_STRING, | |
pub UNNECESSARY_OWNED_EMPTY_STRINGS, |
Lint names are usually better in the plural form, when they aren't describing a specific function name. This usually reads better in combination with allow
.
This change will require cargo dev update_lints
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
unnecessary_owned_empty_string
unnecessary_owned_empty_strings
@bors r+ |
📌 Commit 1020137 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
[
unnecessary_owned_empty_strings
]Fixes #8650
.stderr
file)cargo test
passes locallycargo dev update_lints
cargo dev fmt
changelog: Adds
unnecessary_owned_empty_strings
, a lint that detects passing owned empty strings to a function expecting&str