Skip to content

Commit 2e9b180

Browse files
authored
Make Clippy and compile_fail tests happy for 1.87 Rust (#471)
1 parent af08fdf commit 2e9b180

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

impl/src/fmt/debug.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ fn expand_enum(
184184
},
185185
)?;
186186

187-
let body = match_arms
188-
.is_empty()
189-
.then(|| quote! { match *self {} })
190-
.unwrap_or_else(|| quote! { match self { #match_arms } });
187+
let body = if match_arms.is_empty() {
188+
quote! { match *self {} }
189+
} else {
190+
quote! { match self { #match_arms } }
191+
};
191192

192193
Ok((bounds, body))
193194
}

impl/src/fmt/display.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,11 @@ fn expand_enum(
381381
},
382382
)?;
383383

384-
let body = match_arms
385-
.is_empty()
386-
.then(|| quote! { match *self {} })
387-
.unwrap_or_else(|| quote! { match self { #match_arms } });
384+
let body = if match_arms.is_empty() {
385+
quote! { match *self {} }
386+
} else {
387+
quote! { match self { #match_arms } }
388+
};
388389

389390
Ok((bounds, body))
390391
}

impl/src/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ impl ContainsGenericsExt for syn::Type {
602602
}
603603

604604
if let Some(ident) = path.get_ident() {
605-
type_params.iter().any(|param| *param == ident)
605+
type_params.contains(&ident)
606606
} else {
607607
path.contains_generics(type_params)
608608
}

tests/compile_fail/try_from/invalid_repr.stderr

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,19 @@ error: expected one of `(`, `,`, `::`, or `=`, found `+`
99
|
1010
3 | #[repr(a + b)]
1111
| ^ expected one of `(`, `,`, `::`, or `=`
12+
13+
error[E0552]: unrecognized representation hint
14+
--> tests/compile_fail/try_from/invalid_repr.rs:3:8
15+
|
16+
3 | #[repr(a + b)]
17+
| ^
18+
|
19+
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
20+
21+
error[E0552]: unrecognized representation hint
22+
--> tests/compile_fail/try_from/invalid_repr.rs:3:12
23+
|
24+
3 | #[repr(a + b)]
25+
| ^
26+
|
27+
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

0 commit comments

Comments
 (0)