Skip to content

Commit

Permalink
Resolve incorrect_partial_ord_impl_on_ord_type clippy lint
Browse files Browse the repository at this point in the history
    warning: incorrect implementation of `partial_cmp` on an `Ord` type
       --> src/cxx_string.rs:242:1
        |
    242 | /  impl PartialOrd for CxxString {
    243 | |      fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        | | _____________________________________________________________-
    244 | ||         self.as_bytes().partial_cmp(other.as_bytes())
    245 | ||     }
        | ||_____- help: change this to: `{ Some(self.cmp(other)) }`
    246 | |  }
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type
        = note: `-W clippy::incorrect-partial-ord-impl-on-ord-type` implied by `-W clippy::all`
  • Loading branch information
dtolnay committed Jul 18, 2023
1 parent 1a608a7 commit a5e4f14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cxx_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Eq for CxxString {}

impl PartialOrd for CxxString {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.as_bytes().partial_cmp(other.as_bytes())
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit a5e4f14

Please sign in to comment.