aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2023-05-26 23:02:47 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-05-26 23:02:47 +0000
commitd7dff274fbd77676619bbabd0bfa32da262038ae (patch)
tree21603471c67f8913847b30d7ebe4409106185382
parentcc6ae7f488c17685626548f5d5ceae30929fe83e (diff)
parentebfcde5952543a001d48d53674cfe0660fcf81f7 (diff)
downloadremain-d7dff274fbd77676619bbabd0bfa32da262038ae.tar.gz
Upgrade remain to 0.2.8 am: cb99d6bbf8 am: ebfcde5952
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/remain/+/2520460 Change-Id: I7cf8417b6cd255cac5a6afcee9b8b16082e529a7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--.clippy.toml1
-rw-r--r--.github/FUNDING.yml1
-rw-r--r--.github/workflows/ci.yml61
-rw-r--r--Android.bp4
-rw-r--r--Cargo.toml6
-rw-r--r--Cargo.toml.orig6
-rw-r--r--LICENSE-APACHE25
-rw-r--r--METADATA15
-rw-r--r--src/check.rs2
-rw-r--r--src/lib.rs2
-rw-r--r--src/parse.rs4
-rw-r--r--src/visit.rs8
-rw-r--r--tests/stable.rs2
-rw-r--r--tests/unstable.rs6
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
diff --git a/Android.bp b/Android.bp
index 26a3eff..43e8f05 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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",
diff --git a/Cargo.toml b/Cargo.toml
index 39da45b..685b30c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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.
diff --git a/METADATA b/METADATA
index 7f97c56..4bd0564 100644
--- a/METADATA
+++ b/METADATA
@@ -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);
diff --git a/src/lib.rs b/src/lib.rs
index a043b1f..298c478 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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)]