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
warning: this argument is passed by value, but not consumed in the function body
--> examples/borrow.rs:4:13
|
4 | fn mylen(s: String) -> usize {
| ^^^^^^ help: consider changing the type to: `&str`
|
note: the lint level is defined here
--> examples/borrow.rs:2:9
|
2 | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::needless_pass_by_value)]` implied by `#[warn(clippy::pedantic)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
error: writing `&String` instead of `&str` involves a new object where a slice will do
--> examples/borrow.rs:8:14
|
8 | fn mylen2(s: &String) -> usize {
| ^^^^^^^ help: change this to: `&str`
|
note: the lint level is defined here
--> examples/borrow.rs:1:9
|
1 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::ptr_arg)]` implied by `#[deny(clippy::all)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
I am advocating for more prominent clippy cross-referencing. This could be in the form of a big box that says something like:
I think these note boxes should be added to all applicable idioms. We are all human and tend to miss something at some point. If clippy rules exist that can be used to enforce idioms, they should be prominently highlighted in the respective sections.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Some of the idioms can be checked with clippy, e.g.:
I am advocating for more prominent clippy cross-referencing. This could be in the form of a big box that says something like:
I think these note boxes should be added to all applicable idioms. We are all human and tend to miss something at some point. If clippy rules exist that can be used to enforce idioms, they should be prominently highlighted in the respective sections.
Beta Was this translation helpful? Give feedback.
All reactions