Skip to content

Commit

Permalink
Placate clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicHorrorDev committed Nov 24, 2023
1 parent 11579ef commit adbb562
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/libraryfolders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ pub fn parse_library_folders(path: &Path) -> Result<LibraryIter> {
.filter(|(key, _)| key.parse::<u32>().is_ok())
.map(|(_, values)| {
values
.get(0)
.first()
.and_then(|value| value.get_obj())
.and_then(|obj| obj.get("path"))
.and_then(|values| values.get(0))
.and_then(|values| values.first())
.and_then(|value| value.get_str())
.ok_or_else(|| {
Error::parse(
Expand Down
38 changes: 18 additions & 20 deletions src/shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,25 @@ impl Iterator for ShortcutIter {
#[must_use]
fn after_many_case_insensitive(it: &mut Peekable<Iter<u8>>, needle: &[u8]) -> bool {
loop {
loop {
let mut needle_it = needle.iter();
let b = match it.next() {
Some(b) => b,
None => return false,
};

let maybe_needle_b = needle_it.next();
if maybe_u8_eq_ignore_ascii_case(maybe_needle_b, Some(b)) {
loop {
if needle_it.len() == 0 {
return true;
}
let mut needle_it = needle.iter();
let b = match it.next() {
Some(b) => b,
None => return false,
};

let maybe_b = it.peek();
let maybe_needle_b = needle_it.next();
if maybe_u8_eq_ignore_ascii_case(maybe_needle_b, maybe_b.copied()) {
let _ = it.next();
} else {
break;
}
let maybe_needle_b = needle_it.next();
if maybe_u8_eq_ignore_ascii_case(maybe_needle_b, Some(b)) {
loop {
if needle_it.len() == 0 {
return true;
}

let maybe_b = it.peek();
let maybe_needle_b = needle_it.next();
if maybe_u8_eq_ignore_ascii_case(maybe_needle_b, maybe_b.copied()) {
let _ = it.next();
} else {
break;
}
}
}
Expand Down

0 comments on commit adbb562

Please sign in to comment.