Skip to content

Commit

Permalink
Fix PartialOrd implementation of Position (#2172)
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe authored Oct 6, 2023
1 parent 0ee7c8e commit 27a9fd1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions lib/mir/src/analysis/reference_count/transformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ fn transform_expression(

let alternative_moved_variables = default_alternative_moved_variables
.iter()
.cloned()
.filter(|variable| {
.filter(|&variable| {
if let Some(alternative) = case.default_alternative() {
variable != alternative.name()
} else {
true
}
})
.cloned()
.chain(
alternative_tuples
.iter()
.flat_map(|(alternative, moved_variables)| {
moved_variables
.iter()
.filter(|&variable| variable != alternative.name())
.cloned()
.filter(|variable| variable != alternative.name())
.collect::<FnvHashSet<_>>()
}),
)
Expand Down Expand Up @@ -316,8 +316,8 @@ fn transform_expression(
&let_owned_variables,
&moved_variables
.iter()
.filter(|&variable| variable != let_.name())
.cloned()
.filter(|variable| variable != let_.name())
.collect(),
)?;
let (bound_expression, moved_variables) = transform_expression(
Expand All @@ -329,8 +329,8 @@ fn transform_expression(
.chain(
expression_moved_variables
.iter()
.cloned()
.filter(|variable| variable != let_.name()),
.filter(|&variable| variable != let_.name())
.cloned(),
)
.collect(),
)?;
Expand Down Expand Up @@ -368,8 +368,8 @@ fn transform_expression(
&let_owned_variables,
&moved_variables
.iter()
.filter(|&variable| variable != let_.definition().name())
.cloned()
.filter(|variable| variable != let_.definition().name())
.collect(),
)?;
let moved_variables = moved_variables
Expand All @@ -378,8 +378,8 @@ fn transform_expression(
.chain(
expression_moved_variables
.iter()
.cloned()
.filter(|variable| variable != let_.definition().name()),
.filter(|&variable| variable != let_.definition().name())
.cloned(),
)
.collect();
let cloned_variables = let_
Expand Down
4 changes: 2 additions & 2 deletions lib/position/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ impl Ord for Position {
}

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

Expand Down
2 changes: 1 addition & 1 deletion packages/core/ffi/src/character.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const INVALID_CODE_POINT: ffi::Number = ffi::Number::new(f64::NAN);
fn _pen_core_character_from_code_point(code_point: ffi::Number) -> ffi::ByteString {
char::from_u32(f64::from(code_point) as u32)
.map(ffi::ByteString::from)
.unwrap_or_else(ffi::ByteString::default)
.unwrap_or_default()
}

#[ffi::bindgen]
Expand Down

0 comments on commit 27a9fd1

Please sign in to comment.