Skip to content

Commit

Permalink
Ord: Fix build when PartialOrd is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ijackson committed Feb 20, 2024
1 parent ecaf0f2 commit 7b9a95c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/trait_handlers/ord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ impl TraitHandler for OrdHandler {
}

Check warning on line 33 in src/trait_handlers/ord/mod.rs

View workflow job for this annotation

GitHub Actions / rustfmt

Diff in /home/runner/work/educe/educe/src/trait_handlers/ord/mod.rs
}

fn supertraits(traits: &[Trait]) -> Vec<proc_macro2::TokenStream> {
fn supertraits(
#[allow(unused_variables)]
traits: &[Trait],
) -> Vec<proc_macro2::TokenStream> {
let mut supertraits = vec![];
supertraits.push(quote! {::core::cmp::Eq});

// We mustn't add the PartialOrd bound to the educed PartialOrd impl.
// When we're educing PartialOrd we can leave it off the Ord impl too,
// since we *know* Self is going to be PartialOrd.
#[cfg(feature = "PartialOrd")]
if !traits.contains(&Trait::PartialOrd) {
supertraits.push(quote! {::core::cmp::PartialOrd});
};
Expand Down

0 comments on commit 7b9a95c

Please sign in to comment.