Skip to content

Commit

Permalink
Do not use is_some_and due to MSRV
Browse files Browse the repository at this point in the history
  • Loading branch information
novafacing committed Jul 31, 2023
1 parent 13944b1 commit 41396a6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/bindgen/ir/annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ impl AnnotationSet {
.ok_or("Could not find suffix in line")?;
let prefix = first_line[..suffix_index].to_string();

while value_lines.last().is_some_and(|l| l.ends_with('\\')) {
while let Some(last) = value_lines.last() {
if !last.ends_with('\\') {
break;
}

i += 1;
let s = &attrs_lines[i];
value_lines.push(s.to_string());
Expand All @@ -118,8 +122,10 @@ impl AnnotationSet {
.trim_end()
.to_string();

if l.find(&prefix).is_some_and(|i| i == 0) {
l = l.replacen(&prefix, "", 1);
if let Some(line) = l.find(&prefix) {
if line == 0 {
l = l.replacen(&prefix, "", 1);
}
}

l
Expand Down

0 comments on commit 41396a6

Please sign in to comment.