Skip to content

Commit

Permalink
clippy 1.74.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lorepozo committed Dec 15, 2023
1 parent a515148 commit ba2d184
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/lambda/enumerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,15 @@ mod bfs {
}
impl Eq for BestFirstState {}
impl PartialOrd for BestFirstState {
fn partial_cmp(&self, other: &BestFirstState) -> Option<::std::cmp::Ordering> {
self.cost.partial_cmp(&other.cost)
fn partial_cmp(&self, other: &BestFirstState) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for BestFirstState {
fn cmp(&self, other: &BestFirstState) -> ::std::cmp::Ordering {
self.partial_cmp(other).unwrap()
fn cmp(&self, other: &BestFirstState) -> std::cmp::Ordering {
self.cost
.partial_cmp(&other.cost)
.expect("cost for BestFirstState is not finite")
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/lambda/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ impl Language {
}
// update probabilities for indices
let log_n_indexed = ((cands.len() - indexed_start) as f64).ln();
for mut c in &mut cands[indexed_start..] {
for c in &mut cands[indexed_start..] {
c.0 -= log_n_indexed
}
// normalize
Expand All @@ -574,7 +574,7 @@ impl Language {
.map(|&(p, _, _, _)| (p - p_largest).exp())
.sum::<f64>()
.ln();
for mut c in &mut cands {
for c in &mut cands {
c.0 -= z;
}
cands
Expand Down
5 changes: 3 additions & 2 deletions src/pcfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,14 @@ impl Rule {
}
impl Ord for Rule {
fn cmp(&self, other: &Rule) -> cmp::Ordering {
self.partial_cmp(other)
self.logprob
.partial_cmp(&other.logprob)
.expect("logprob for rule is not finite")
}
}
impl PartialOrd for Rule {
fn partial_cmp(&self, other: &Rule) -> Option<cmp::Ordering> {
self.logprob.partial_cmp(&other.logprob)
Some(self.cmp(other))
}
}
impl PartialEq for Rule {
Expand Down

0 comments on commit ba2d184

Please sign in to comment.