Skip to content

Commit f3e1aaf

Browse files
Clippy (#48)
* Clippy * allow more * Bump github pages Ubuntu image
1 parent 7da3978 commit f3e1aaf

File tree

11 files changed

+21
-5
lines changed

11 files changed

+21
-5
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
deploy:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.ref }}
1414
steps:

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ pub fn superstruct(args: TokenStream, input: TokenStream) -> TokenStream {
265265
let is_common_meta = opts
266266
.meta_variants
267267
.as_ref()
268-
.map_or(true, |struct_meta_variants| {
268+
.is_none_or(|struct_meta_variants| {
269269
struct_meta_variants.idents.len() == field_meta_variants.len()
270270
});
271271
let is_common = field_variants.len() == variant_names.len() && is_common_meta;
@@ -1143,7 +1143,7 @@ fn is_superstruct_attr(attr: &Attribute) -> bool {
11431143
fn is_attr_with_ident(attr: &Attribute, ident: &str) -> bool {
11441144
attr.path()
11451145
.get_ident()
1146-
.map_or(false, |attr_ident| *attr_ident == ident)
1146+
.is_some_and(|attr_ident| *attr_ident == ident)
11471147
}
11481148

11491149
/// Predicate for determining whether a field should be excluded from a flattened
@@ -1160,7 +1160,7 @@ fn should_skip(
11601160
Override::Inherit => false,
11611161
Override::Explicit(map) => {
11621162
let contains_variant = map.contains_key(variant);
1163-
let contains_meta_variant = meta_variant.map_or(true, |mv| map.contains_key(mv));
1163+
let contains_meta_variant = meta_variant.is_none_or(|mv| map.contains_key(mv));
11641164

11651165
let variants_exist = variant_names.iter().any(|v| map.contains_key(v));
11661166
let meta_variants_exist = meta_variant_names

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn snake_case(ident: &str) -> String {
2626
/// Create a generics block like `<_, _, _>` with `num_generics` underscores.
2727
pub fn underscore_generics(num_generics: usize) -> proc_macro2::TokenStream {
2828
let underscore = Token![_](Span::call_site());
29-
let underscores = std::iter::repeat(quote! { #underscore }).take(num_generics);
29+
let underscores = std::iter::repeat_n(quote! { #underscore }, num_generics);
3030
quote! { <#(#underscores),*> }
3131
}
3232

tests/basic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use serde::Deserialize;
24
use superstruct::superstruct;
35

tests/flatten.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use superstruct::superstruct;
24

35
#[test]

tests/from.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use std::fmt::Display;
24
use superstruct::superstruct;
35

tests/map_macro.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use superstruct::superstruct;
24

35
#[test]

tests/meta_variant.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use superstruct::superstruct;
24

35
#[superstruct(

tests/ref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use superstruct::superstruct;
24

35
// Check that we can convert a Ref to an inner reference with the same lifetime as `message`.

tests/ref_mut.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)] // for macros on structs within test functions
2+
13
use superstruct::superstruct;
24

35
#[test]

0 commit comments

Comments
 (0)