Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
73 changes: 20 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,45 @@ env:

jobs:
build_and_test:
name: Deluxe
name: Build & Test
strategy:
matrix:
features: ["--all-features", "--no-default-features"]
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: cargo build -r --all-features --workspace
- run: cargo test -r --all-features --workspace

build_and_test_no_default:
name: Deluxe No Default Features
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: cargo build -r --no-default-features --workspace
- run: cargo test -r --no-default-features --workspace
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build -r ${{ matrix.features }} --workspace
- run: cargo test -r ${{ matrix.features }} --workspace

rustfmt:
name: Deluxe Rustfmt
name: Rustfmt
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- run: cargo fmt --all --check

clippy:
name: Deluxe Clippy
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace
- run: cargo clippy --workspace --all-targets

docs:
name: Deluxe Docs
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rust-docs
- uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo doc --workspace --no-deps
7 changes: 4 additions & 3 deletions core/parse_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,10 @@ where
P: crate::ParseAttributes<'t, T>,
T: crate::HasAttributes,
{
T::attrs(input).iter().filter_map(|a| {
P::path_matches(a.path()).then(|| {
T::attrs(input)
.iter()
.filter(|&a| P::path_matches(a.path()))
.map(|a| {
let value = match &a.meta {
syn::Meta::Path(_) => Default::default(),
syn::Meta::List(list) => proc_macro2::TokenTree::Group(proc_macro2::Group::new(
Expand All @@ -956,7 +958,6 @@ where
};
(value, key_to_string(a.path()), a.path().span())
})
})
}

/// Returns an iterator of [`TokenStream`](proc_macro2::TokenStream)s and the corresponding path
Expand Down
1 change: 1 addition & 0 deletions core/small_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl<'a> Ord for SmallString<'a> {
}
}

#[allow(clippy::non_canonical_partial_ord_impl)]
impl<'a> PartialOrd for SmallString<'a> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Expand Down
29 changes: 17 additions & 12 deletions macros/types/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,13 @@ impl<'f> Field<'f> {
.enumerate()
.map(|(i, _)| quote::format_ident!("field{i}", span = Span::mixed_site()))
.collect::<Vec<_>>();
let container_def = fields.iter().enumerate().filter_map(|(i, f)| {
(f.is_container() && *mode != TokenMode::ParseMetaItem).then(|| {
let name = names[i].clone();
let container_def = fields
.iter()
.zip(&names)
.filter_map(|(f, name)| {
(f.is_container() && *mode != TokenMode::ParseMetaItem).then_some(name)
})
.map(|name| {
let func = match mode {
TokenMode::ParseAttributes => quote! { container_from },
TokenMode::ExtractAttributes => quote! { container_from_mut },
Expand All @@ -518,8 +522,7 @@ impl<'f> Field<'f> {
quote_mixed! {
#name = #priv_::FieldStatus::Some(#crate_::ContainerFrom::#func(obj));
}
})
});
});
let field_errors = {
let mut cur_index = 0usize;
let mut extra_counts = quote! {};
Expand Down Expand Up @@ -685,14 +688,16 @@ impl<'f> Field<'f> {
#(#transforms)*
}
});
let field_unwraps = fields.iter().enumerate().filter_map(|(i, _)| {
(!matches!(target, ParseTarget::Var(_))).then(|| {
let name = &names[i];
quote_mixed! {
let #name = #name.unwrap_or_else(|| #priv_::unreachable!());
}
let field_unwraps = (!matches!(target, ParseTarget::Var(_)))
.then(|| {
names.iter().take(fields.len()).map(|name| {
quote_mixed! {
let #name = #name.unwrap_or_else(|| #priv_::unreachable!());
}
})
})
});
.into_iter()
.flatten();

let option_inits = fields.iter().enumerate().map(|(i, f)| {
let name = &names[i];
Expand Down