diff options
author | Haibo Huang <hhb@google.com> | 2021-01-06 23:00:22 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-01-06 23:00:22 +0000 |
commit | f14d6a686a8e9eb9359369569e06983a10e5d694 (patch) | |
tree | b4a59a0bf295d7cc3837dd372b5068cb95023fc6 /tests/lint.rs | |
parent | 932883e65ccd882ab2f97188ef66a0aa7cf339a7 (diff) | |
parent | 1f8d1834e3d402e53170cd757f0554d2984688ab (diff) | |
download | pin-project-f14d6a686a8e9eb9359369569e06983a10e5d694.tar.gz |
Upgrade rust/crates/pin-project to 1.0.3 am: 803535edf4 am: edabc1003f am: 1f8d1834e3
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pin-project/+/1541052
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ib29efe0f160a29b3b80e05e765a40ad617cb9208
Diffstat (limited to 'tests/lint.rs')
-rw-r--r-- | tests/lint.rs | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/tests/lint.rs b/tests/lint.rs index c7f1380..b577e0e 100644 --- a/tests/lint.rs +++ b/tests/lint.rs @@ -39,6 +39,8 @@ // Check interoperability with rustc and clippy lints. +mod auxiliary; + pub mod basic { include!("include/basic.rs"); @@ -1023,42 +1025,15 @@ pub mod clippy_used_underscore_binding { // Run `./dev.sh +$toolchain test --test lint` to update this. #[cfg(not(miri))] -#[allow(box_pointers)] #[allow(clippy::restriction)] -#[rustversion::attr(before(2020-11-08), ignore)] // Note: This date is commit-date and the day before the toolchain date. +#[rustversion::attr(before(2020-12-25), ignore)] // Note: This date is commit-date and the day before the toolchain date. #[test] fn check_lint_list() { - use std::{env, fs, path::Path, process::Command, str}; - - type Result<T, E = Box<dyn std::error::Error>> = std::result::Result<T, E>; - - fn assert_eq(expected_path: &str, actual: &str) -> Result<()> { - let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR")); - let expected_path = &manifest_dir.join(expected_path); - let expected = fs::read_to_string(expected_path)?; - if expected != actual { - if env::var_os("CI").is_some() { - let actual_path = - &manifest_dir.join("target").join(expected_path.file_name().unwrap()); - fs::write(actual_path, actual)?; - let status = Command::new("git") - .args(&["--no-pager", "diff", "--no-index", "--"]) - .args(&[expected_path, actual_path]) - .status()?; - assert!(!status.success()); - panic!("assertion failed"); - } else { - fs::write(expected_path, actual)?; - } - } - Ok(()) - } + use auxiliary::assert_diff; + use std::{env, process::Command, str}; - (|| -> Result<()> { - let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); - let output = Command::new(rustc).args(&["-W", "help"]).output()?; - let new = str::from_utf8(&output.stdout)?; - assert_eq("tests/lint.txt", new) - })() - .unwrap_or_else(|e| panic!("{}", e)); + let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); + let output = Command::new(rustc).args(&["-W", "help"]).output().unwrap(); + let new = str::from_utf8(&output.stdout).unwrap(); + assert_diff("tests/lint.txt", new); } |