Skip to content

Commit

Permalink
Merge pull request #20 from dtolnay/syn
Browse files Browse the repository at this point in the history
Update to syn 2
  • Loading branch information
dtolnay authored Mar 18, 2023
2 parents ee9f1f5 + fb29e41 commit b8cd974
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.31.0"
msrv = "1.56.0"
11 changes: 0 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ jobs:
env:
RUSTFLAGS: --cfg remain_stable_testing ${{env.RUSTFLAGS}}

msrv:
name: Rust 1.31.0
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- run: cargo check

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ documentation = "https://docs.rs/remain"
edition = "2018"
license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/remain"
rust-version = "1.31"
rust-version = "1.56"

[lib]
proc-macro = true

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["full", "visit-mut"] }
syn = { version = "2.0", features = ["full", "visit-mut"] }

[dev-dependencies]
rustversion = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where

fn remove_unsorted_attr(attrs: &mut Vec<Attribute>) -> bool {
for i in 0..attrs.len() {
let path = &attrs[i].path;
let path = &attrs[i].path();
let path = quote!(#path).to_string();
if path == "unsorted" || path == "remain :: unsorted" {
attrs.remove(i);
Expand Down
4 changes: 2 additions & 2 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ impl Parse for Input {
_ => unreachable!("expected let"),
};
let init = match stmt.init {
Some((_, init)) => *init,
Some(init) => init,
None => return Err(unexpected()),
};
let expr = match init {
let expr = match *init.expr {
Expr::Match(expr) => expr,
_ => return Err(unexpected()),
};
Expand Down
8 changes: 4 additions & 4 deletions src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ impl VisitMut for Checker {
visit_mut::visit_local_mut(self, local);

let init = match &local.init {
Some((_, init)) => init,
Some(init) => init,
None => return,
};

let expr_match = match init.as_ref() {
let expr_match = match init.expr.as_ref() {
Expr::Match(expr) => expr,
_ => return,
};
Expand All @@ -45,14 +45,14 @@ impl VisitMut for Checker {
}

let input = expr_match.clone();
let expr = local.init.as_mut().unwrap().1.as_mut();
let expr = local.init.as_mut().unwrap().expr.as_mut();
check_and_insert_error(input, expr);
}
}

fn take_sorted_attr(attrs: &mut Vec<Attribute>) -> bool {
for i in 0..attrs.len() {
let path = &attrs[i].path;
let path = &attrs[i].path();
let path = quote!(#path).to_string();
if path == "sorted" || path == "remain :: sorted" {
attrs.remove(i);
Expand Down

0 comments on commit b8cd974

Please sign in to comment.