Skip to content

Commit 1e3de0d

Browse files
Swatinemjrmuizel
authored andcommitted
fix: Make clippy happy
1 parent 7a67409 commit 1e3de0d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,15 +2231,15 @@ impl<'a> Serializer<'a> {
22312231
Name::Operator(ref op) => {
22322232
match *op {
22332233
Operator::Ctor => {
2234-
let prev = names.scope.names.iter().next().ok_or_else(|| {
2234+
let prev = names.scope.names.get(0).ok_or_else(|| {
22352235
Error::new(
22362236
"If there's a ctor, there should be another name in this sequence",
22372237
)
22382238
})?;
22392239
self.write_one_name(prev)?;
22402240
}
22412241
Operator::Dtor => {
2242-
let prev = names.scope.names.iter().next().ok_or_else(|| {
2242+
let prev = names.scope.names.get(0).ok_or_else(|| {
22432243
Error::new(
22442244
"If there's a dtor, there should be another name in this sequence",
22452245
)

tests/test_llvm.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn parse_cases<'a, I: Iterator<Item = &'a str>>(i: I) -> impl Iterator<Item = Te
2929
Some(LineRule::CheckNotInvalid)
3030
} else if item.starts_with("; CHECK-NOT: ") {
3131
panic!("unsupported rule: {}", &item[2..]);
32-
} else if item.starts_with("; CHECK: ") {
33-
Some(LineRule::Check(&item[9..]))
32+
} else if let Some(item) = item.strip_prefix("; CHECK: ") {
33+
Some(LineRule::Check(item))
3434
} else if item.starts_with(';') {
3535
None
3636
} else {
@@ -45,7 +45,9 @@ fn parse_cases<'a, I: Iterator<Item = &'a str>>(i: I) -> impl Iterator<Item = Te
4545
Some(LineRule::CheckNotInvalid) => {
4646
not_invalid = true;
4747
}
48-
Some(LineRule::Input(input)) => {
48+
Some(LineRule::Input(input)) =>
49+
{
50+
#[allow(clippy::while_let_on_iterator)]
4951
while let Some(next) = rule_iter.next() {
5052
match next {
5153
LineRule::CheckNotInvalid => {

0 commit comments

Comments
 (0)