Skip to content

Commit

Permalink
Suppress clippy should_implement_trait lint
Browse files Browse the repository at this point in the history
I think there is no ambiguity in from_str as a method name so "choose a
less ambiguous method name" is unnecessary, and it can't be a FromStr
impl in this case because FromStr's error type cannot borrow from the
input string slice.

    warning: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
      --> serde_derive_internals/src/case.rs:50:5
       |
    50 | /     pub fn from_str(rename_all_str: &str) -> Result<Self, ParseError> {
    51 | |         for (name, rule) in RENAME_RULES {
    52 | |             if rename_all_str == *name {
    53 | |                 return Ok(*rule);
    ...  |
    58 | |         })
    59 | |     }
       | |_____^
       |
       = note: `#[warn(clippy::should_implement_trait)]` on by default
       = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
  • Loading branch information
dtolnay committed Jan 25, 2021
1 parent 6ea446f commit b91713e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions serde_derive_internals/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
cognitive_complexity,
redundant_field_names,
result_unit_err,
should_implement_trait,
trivially_copy_pass_by_ref,
wildcard_in_or_patterns,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/5704
Expand Down

0 comments on commit b91713e

Please sign in to comment.