Skip to content
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

Fix clippy warning related to IString PartialOrd implementation #35

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

ColonelThirtyTwo
Copy link
Contributor

No description provided.

@kirillsemyonkin
Copy link
Collaborator

Please provide description of why is this needed. I'm being more curious than strict, as to why it passed before and why it needs to be written out like this now.

@ColonelThirtyTwo
Copy link
Contributor Author

ColonelThirtyTwo commented Oct 22, 2023

Please provide description of why is this needed. I'm being more curious than strict, as to why it passed before and why it needs to be written out like this now.

As can be seen in the CI failures for my other PRs, the version of clippy included in Rust 1.73.0 issues a new lint for PartialOrd not using the Ord implementaiton, which is true of IString.

> cargo clippy
    Checking implicit-clone v0.4.1 (/home/col/Projects/Code/Libraries/implicit-clone)
error: incorrect implementation of `partial_cmp` on an `Ord` type
   --> src/string.rs:103:9
    |
103 | /          impl $trait<$type2> for $type1 {
104 | |              fn $fn(&self, other: &$type2) -> $ret {
    | | ___________________________________________________-
105 | ||                 $trait::$fn(AsRef::<str>::as_ref(self), AsRef::<str>::as_ref(other))
106 | ||             }
    | ||_____________- help: change this to: `{ Some(self.cmp(other)) }`
107 | |          }
    | |__________^
...
129 |    impl_cmp_as_str!(PartialOrd::<IString, IString>);
    |    ------------------------------------------------ in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type
    = note: `#[deny(clippy::incorrect_partial_ord_impl_on_ord_type)]` on by default
    = note: this error originates in the macro `impl_cmp_as_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: incorrect implementation of `partial_cmp` on an `Ord` type
   --> src/string.rs:103:9
    |
103 | /          impl $trait<$type2> for $type1 {
104 | |              fn $fn(&self, other: &$type2) -> $ret {
    | | ___________________________________________________-
105 | ||                 $trait::$fn(AsRef::<str>::as_ref(self), AsRef::<str>::as_ref(other))
106 | ||             }
    | ||_____________- help: change this to: `{ Some(self.cmp(other)) }`
107 | |          }
    | |__________^
...
129 |    impl_cmp_as_str!(PartialOrd::<IString, IString>);
    |    ------------------------------------------------ in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_partial_ord_impl_on_ord_type
    = note: this error originates in the macro `impl_cmp_as_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `implicit-clone` (lib) due to 2 previous errors

@kirillsemyonkin kirillsemyonkin merged commit 238d464 into yewstack:main Oct 22, 2023
12 checks passed
cecton pushed a commit to cecton/implicit-clone that referenced this pull request Nov 28, 2023
…tack#35)

Clippy added a new lint `clippy::non_canonical_partial_ord_impl` (aka `incorrect_partial_ord_impl_on_ord_type`), hence it should now be followed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants