Skip to content

Commit 9620380

Browse files
committed
clippy: fix a couple nits
Running `cargo +nightly clippy --all-features` finds a couple things in the compiler. Fix these. One is a subtle change to our `OrdF64` type: this is a wrapper type to add `Ord` to f64, panicking in the case that we hit NaN. Previously our `Ord` impl would panic but our `PartialOrd` impl would not. Now they both do.
1 parent 3c1c896 commit 9620380

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/policy/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Eq for OrdF64 {}
3131
// We could derive PartialOrd, but we can't derive Ord, and clippy wants us
3232
// to derive both or neither. Better to be explicit.
3333
impl PartialOrd for OrdF64 {
34-
fn partial_cmp(&self, other: &OrdF64) -> Option<cmp::Ordering> { self.0.partial_cmp(&other.0) }
34+
fn partial_cmp(&self, other: &OrdF64) -> Option<cmp::Ordering> { Some(self.cmp(other)) }
3535
}
3636
impl Ord for OrdF64 {
3737
fn cmp(&self, other: &OrdF64) -> cmp::Ordering {

src/policy/concrete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ fn with_huffman_tree<Pk: MiniscriptKey>(
10931093
/// any one of the conditions exclusively.
10941094
#[cfg(feature = "compiler")]
10951095
fn generate_combination<Pk: MiniscriptKey>(
1096-
policy_vec: &Vec<Arc<Policy<Pk>>>,
1096+
policy_vec: &[Arc<Policy<Pk>>],
10971097
prob: f64,
10981098
k: usize,
10991099
) -> Vec<(f64, Arc<Policy<Pk>>)> {

0 commit comments

Comments
 (0)