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 PartialOrd implementation of Position #2172

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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