Skip to content

Commit

Permalink
appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Jan 13, 2024
1 parent 799e109 commit 5609a45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions capnp/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ impl StructSchema {
let mut candidate_name = fields.get(candidate_index).get_proto().get_name()?;

while lower < upper {
if name == candidate_name {
return Ok(Some(fields.get(candidate_index)));
} else if candidate_name < name {
lower = mid + 1;
} else {
upper = mid;
use core::cmp::Ordering;
match (&name).partial_cmp(&candidate_name) {
Some(Ordering::Equal) => return Ok(Some(fields.get(candidate_index))),
Some(Ordering::Greater) => lower = mid + 1,
Some(Ordering::Less) => upper = mid,
None => unreachable!(),
}
mid = (lower + upper) / 2;
candidate_index = self.raw.generic.members_by_name[mid];
Expand Down

0 comments on commit 5609a45

Please sign in to comment.