diff options
author | Matthew Maurer <mmaurer@google.com> | 2023-05-27 02:52:16 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-05-27 02:52:16 +0000 |
commit | 04e45378bde458c97e9c54dc0b371caf1b8a97ce (patch) | |
tree | 21603471c67f8913847b30d7ebe4409106185382 | |
parent | b10e8d72301a9645e1ff996f4be601a53b96081f (diff) | |
parent | 29549bceecba045630148c56ae6fdc335e99200a (diff) | |
download | remain-04e45378bde458c97e9c54dc0b371caf1b8a97ce.tar.gz |
Upgrade remain to 0.2.8 am: cb99d6bbf8 am: ebfcde5952 am: d7dff274fb am: e56d1f919f am: f1e8552287 am: 29549bceec
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/remain/+/2520460
Change-Id: I6b8c4b71ce18d21fd08fbf8d30f07c30513e2d90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 7 | ||||
-rw-r--r-- | .clippy.toml | 1 | ||||
-rw-r--r-- | .github/FUNDING.yml | 1 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 61 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | Cargo.toml.orig | 6 | ||||
-rw-r--r-- | LICENSE-APACHE | 25 | ||||
-rw-r--r-- | METADATA | 15 | ||||
-rw-r--r-- | src/check.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/parse.rs | 4 | ||||
-rw-r--r-- | src/visit.rs | 8 | ||||
-rw-r--r-- | tests/stable.rs | 2 | ||||
-rw-r--r-- | tests/unstable.rs | 6 |
15 files changed, 91 insertions, 59 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 1ddcd35..85fde91 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,6 @@ { "git": { - "sha1": "4d56185ca2c69113dc7815c2d268388c76d1aea4" - } -} + "sha1": "d9197a8b0b0b5652c22fc9ded094543544dc83d2" + }, + "path_in_vcs": "" +}
\ No newline at end of file diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 0000000..0d369b5 --- /dev/null +++ b/.clippy.toml @@ -0,0 +1 @@ +msrv = "1.56.0" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..7507077 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: dtolnay diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf8f426..6a4eee9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,37 +3,80 @@ name: CI on: push: pull_request: + workflow_dispatch: schedule: [cron: "40 1 * * *"] +permissions: + contents: read + +env: + RUSTFLAGS: -Dwarnings + jobs: + pre_ci: + uses: dtolnay/.github/.github/workflows/pre_ci.yml@master + nightly: name: Rust nightly + needs: pre_ci + if: needs.pre_ci.outputs.continue runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@nightly + - name: Enable type layout randomization + run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV - run: cargo test test: name: Rust ${{matrix.rust}} + needs: pre_ci + if: needs.pre_ci.outputs.continue runs-on: ubuntu-latest strategy: fail-fast: false matrix: - rust: [beta, stable, 1.36.0] + rust: [beta, stable, 1.56.0] + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} - run: cargo test env: - RUSTFLAGS: --cfg remain_stable_testing + RUSTFLAGS: --cfg remain_stable_testing ${{env.RUSTFLAGS}} + + clippy: + name: Clippy + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + timeout-minutes: 45 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@clippy + - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic + + miri: + name: Miri + needs: pre_ci + if: needs.pre_ci.outputs.continue + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@miri + - run: cargo miri test + env: + MIRIFLAGS: -Zmiri-strict-provenance - msrv: - name: Rust 1.31.0 + outdated: + name: Outdated runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@1.31.0 - - run: cargo check + - uses: actions/checkout@v3 + - uses: dtolnay/install@cargo-outdated + - run: cargo outdated --workspace --exit-code 1 @@ -41,7 +41,7 @@ rust_proc_macro { name: "libremain", crate_name: "remain", cargo_env_compat: true, - cargo_pkg_version: "0.2.6", + cargo_pkg_version: "0.2.8", srcs: ["src/lib.rs"], edition: "2018", rustlibs: [ @@ -57,7 +57,7 @@ rust_defaults { name: "remain_test_defaults", crate_name: "remain", cargo_env_compat: true, - cargo_pkg_version: "0.2.6", + cargo_pkg_version: "0.2.8", test_suites: ["general-tests"], auto_gen_config: true, edition: "2018", @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.31" +rust-version = "1.56" name = "remain" -version = "0.2.6" +version = "0.2.8" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Compile-time checks that an enum, struct, or match is written in sorted order." documentation = "https://docs.rs/remain" @@ -38,7 +38,7 @@ version = "1.0" version = "1.0" [dependencies.syn] -version = "1.0" +version = "2.0" features = [ "full", "visit-mut", diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 3b64082..d6cb234 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "remain" -version = "0.2.6" +version = "0.2.8" authors = ["David Tolnay <dtolnay@gmail.com>"] categories = ["development-tools", "no-std"] description = "Compile-time checks that an enum, struct, or match is written in sorted order." @@ -8,7 +8,7 @@ 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 @@ -16,7 +16,7 @@ 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" diff --git a/LICENSE-APACHE b/LICENSE-APACHE index 16fe87b..1b5ec8b 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. @@ -1,3 +1,7 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update rust/crates/remain +# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md + name: "remain" description: "Compile-time checks that an enum, struct, or match is written in sorted order." third_party { @@ -7,14 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/remain/remain-0.2.6.crate" + value: "https://static.crates.io/crates/remain/remain-0.2.8.crate" } - version: "0.2.6" - # Dual-licensed, using the least restrictive per go/thirdpartylicenses#same. + version: "0.2.8" license_type: NOTICE last_upgrade_date { - year: 2022 - month: 12 - day: 19 + year: 2023 + month: 3 + day: 27 } } diff --git a/src/check.rs b/src/check.rs index 39a23e5..05c0b20 100644 --- a/src/check.rs +++ b/src/check.rs @@ -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); @@ -143,9 +143,11 @@ //! # fn main() {} //! ``` +#![doc(html_root_url = "https://docs.rs/remain/0.2.8")] #![allow( clippy::derive_partial_eq_without_eq, clippy::enum_glob_use, + clippy::let_underscore_untyped, clippy::manual_find, clippy::match_same_arms, clippy::module_name_repetitions, diff --git a/src/parse.rs b/src/parse.rs index 66f80fe..796f31f 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -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()), }; diff --git a/src/visit.rs b/src/visit.rs index f5cecbd..72c07cb 100644 --- a/src/visit.rs +++ b/src/visit.rs @@ -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, }; @@ -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); diff --git a/tests/stable.rs b/tests/stable.rs index 6207079..c67aead 100644 --- a/tests/stable.rs +++ b/tests/stable.rs @@ -1,6 +1,8 @@ #![allow(dead_code)] #![allow( clippy::derive_partial_eq_without_eq, + clippy::extra_unused_type_parameters, + clippy::let_underscore_untyped, clippy::let_unit_value, clippy::match_same_arms )] diff --git a/tests/unstable.rs b/tests/unstable.rs index c0a0c65..dd9fa80 100644 --- a/tests/unstable.rs +++ b/tests/unstable.rs @@ -1,7 +1,11 @@ #![allow(dead_code)] #![cfg(not(remain_stable_testing))] #![feature(proc_macro_hygiene, stmt_expr_attributes)] -#![allow(clippy::derive_partial_eq_without_eq, clippy::match_same_arms)] +#![allow( + clippy::derive_partial_eq_without_eq, + clippy::extra_unused_type_parameters, + clippy::match_same_arms +)] #[remain::sorted] #[derive(PartialEq)] |