Skip to content

Commit 6ab701b

Browse files
authored
Merge pull request #136 from obeis/use-is-empty
Replace length comparison to zero by `is_empty()` method
2 parents 47f418f + feeb43d commit 6ab701b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

crates/formality-prove/src/decls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Decls {
5454
.iter()
5555
.filter(|t| t.id == *trait_id)
5656
.collect();
57-
assert!(v.len() > 0, "no traits named `{trait_id:?}`");
57+
assert!(!v.is_empty(), "no traits named `{trait_id:?}`");
5858
assert!(v.len() <= 1, "multiple traits named `{trait_id:?}`");
5959
v.pop().unwrap()
6060
}

crates/formality-prove/src/prove/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Constraints {
118118
where
119119
V: Upcast<Variable> + Copy,
120120
{
121-
if v.len() == 0 {
121+
if v.is_empty() {
122122
return self;
123123
}
124124

crates/formality-prove/src/prove/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl Env {
180180
where
181181
V: Upcast<Variable> + Copy,
182182
{
183-
if v.len() == 0 {
183+
if v.is_empty() {
184184
return vec![];
185185
}
186186

crates/formality-types/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ where
415415
panic!("parsing ambiguity: {results:?}");
416416
} else if results.len() == 1 {
417417
Ok(results.pop().unwrap())
418-
} else if errors.len() == 0 {
418+
} else if errors.is_empty() {
419419
Err(ParseError::at(text, format!("{} expected", expected)))
420420
} else {
421421
Err(errors)

0 commit comments

Comments
 (0)