Skip to content

Commit

Permalink
ci: fix test_exhaustive_checks step + downgrade package for MSRV te…
Browse files Browse the repository at this point in the history
…st (#280)

* ci: fix `test_exhaustive_checks` step

* ci: downgrade package for MSRV build
  • Loading branch information
dj8yfo authored Feb 26, 2024
1 parent 19e9fee commit 76f0726
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
run: rustup default ${{ matrix.rust_version }}
- name: print rustc version
run: rustc --version
- name: downgrade `toml_edit`, time`, `toml_datetime` crate to support older Rust toolchain
if: matrix.rust_version == '1.67.0'
run: |
cargo update -p toml_edit --precise 0.21.0
- name: Run tests
run: ./.github/test.sh

Expand All @@ -51,7 +55,7 @@ jobs:
# consult https://github.com/serde-rs/serde/blob/master/serde_derive/src/bound.rs#L100 ,
# the implementation of `FindTyParams` may have been updated already
- name: Run exhaustive check tests
run: cargo check --workspace --features force_exhaustive_checks
run: RUSTFLAGS="-A unused_imports -D warnings" cargo check --workspace --features force_exhaustive_checks

clippy:
runs-on: ubuntu-20.04
Expand Down
24 changes: 12 additions & 12 deletions borsh-derive/src/internals/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,17 @@ impl FindTyParams {
PathArguments::None => {}
PathArguments::AngleBracketed(arguments) => {
for arg in &arguments.args {
#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
match arg {
GenericArgument::Type(arg) => self.visit_type(arg),
GenericArgument::AssocType(arg) => self.visit_type(&arg.ty),
GenericArgument::Lifetime(_)
| GenericArgument::Const(_)
| GenericArgument::AssocConst(_)
| GenericArgument::Constraint(_) => {}
#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
_ => {}
}
}
Expand Down Expand Up @@ -253,13 +253,13 @@ impl FindTyParams {
}

fn visit_type_param_bound(&mut self, bound: &TypeParamBound) {
#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
match bound {
TypeParamBound::Trait(bound) => self.visit_path(&bound.path),
TypeParamBound::Lifetime(_) | TypeParamBound::Verbatim(_) => {}
#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
_ => {}
}
}
Expand All @@ -272,6 +272,10 @@ impl FindTyParams {
fn visit_macro(&mut self, _mac: &Macro) {}

fn visit_type(&mut self, ty: &Type) {
#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
match ty {
Type::Array(ty) => self.visit_type(&ty.elem),
Type::BareFn(ty) => {
Expand Down Expand Up @@ -310,10 +314,6 @@ impl FindTyParams {

Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {}

#[cfg_attr(
feature = "force_exhaustive_checks",
deny(non_exhaustive_omitted_patterns)
)]
_ => {}
}
}
Expand Down

0 comments on commit 76f0726

Please sign in to comment.