From 502a1fbc7945351b192e1a8d3cfaf8f7157a9bf6 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 12 Oct 2023 21:46:04 +0900 Subject: [PATCH] Update expandtest --- .github/.cspell/project-dictionary.txt | 1 - .github/dependabot.yml | 4 --- .github/workflows/ci.yml | 4 --- Cargo.toml | 9 +------ tests/expand/pinned_drop/enum.expanded.rs | 1 - tests/expand/pinned_drop/enum.rs | 2 -- tests/expand/pinned_drop/struct.expanded.rs | 1 - tests/expand/pinned_drop/struct.rs | 2 -- tests/expandtest.rs | 29 ++------------------- 9 files changed, 3 insertions(+), 50 deletions(-) diff --git a/.github/.cspell/project-dictionary.txt b/.github/.cspell/project-dictionary.txt index 9b57d21..5f77d3c 100644 --- a/.github/.cspell/project-dictionary.txt +++ b/.github/.cspell/project-dictionary.txt @@ -1,6 +1,5 @@ compiletest expandtest metavariables -prettyplease reborrow wontfix diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8b79f09..2a7e898 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,9 +9,5 @@ updates: ignore: # For test on MSRV. - dependency-name: once_cell - - dependency-name: proc-macro2 - - dependency-name: quote - - dependency-name: serde - - dependency-name: toml - dependency-name: trybuild labels: [] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f89edea..79f05c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,10 +69,6 @@ jobs: - uses: taiki-e/install-action@cargo-minimal-versions - uses: taiki-e/install-action@cargo-careful if: startsWith(matrix.rust, 'nightly') - - uses: taiki-e/cache-cargo-install-action@v1 - with: - tool: cargo-expand - if: startsWith(matrix.rust, 'nightly') - run: cargo test --all --all-features - run: cargo careful test --all --all-features env: diff --git a/Cargo.toml b/Cargo.toml index 59f41c5..f1661ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,17 +25,10 @@ members = [ doc-scrape-examples = false [dev-dependencies] -macrotest = "1.0.9" +macrotest = { git = "https://github.com/taiki-e/macrotest.git", branch = "dev-old-msrv" } # 2021 edition support + lower MSRV + no cargo-expand rustversion = "1" static_assertions = "1" trybuild = "=1.0.67" # For test on MSRV. once_cell = "=1.14" -proc-macro2 = "=1.0.65" -quote = "=1.0.30" -serde = "=1.0.156" -toml = "=0.5.9" - -[patch.crates-io] -prettyplease = { git = "https://github.com/taiki-e/prettyplease.git", branch = "dev" } # lower MSRV diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index 03901ce..ce513ea 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -1,4 +1,3 @@ -use std::pin::Pin; use pin_project_lite::pin_project; enum Enum { Struct { pinned: T, unpinned: U }, diff --git a/tests/expand/pinned_drop/enum.rs b/tests/expand/pinned_drop/enum.rs index 6e4f460..1449c9a 100644 --- a/tests/expand/pinned_drop/enum.rs +++ b/tests/expand/pinned_drop/enum.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::pin::Pin; - use pin_project_lite::pin_project; pin_project! { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index f3fa923..47f1912 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -1,4 +1,3 @@ -use std::pin::Pin; use pin_project_lite::pin_project; struct Struct { pinned: T, diff --git a/tests/expand/pinned_drop/struct.rs b/tests/expand/pinned_drop/struct.rs index 3152197..0a61c20 100644 --- a/tests/expand/pinned_drop/struct.rs +++ b/tests/expand/pinned_drop/struct.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::pin::Pin; - use pin_project_lite::pin_project; pin_project! { diff --git a/tests/expandtest.rs b/tests/expandtest.rs index dde8b0f..51b5596 100644 --- a/tests/expandtest.rs +++ b/tests/expandtest.rs @@ -4,43 +4,18 @@ #![cfg(not(careful))] #![warn(rust_2018_idioms, single_use_lifetimes)] -use std::{ - env, - process::{Command, ExitStatus, Stdio}, -}; +use std::env; const PATH: &str = "tests/expand/**/*.rs"; #[rustversion::attr(not(nightly), ignore)] #[test] fn expandtest() { - let is_ci = env::var_os("CI").is_some(); - let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into()); - if !has_command(&[cargo, "expand"]) { - if is_ci { - panic!("expandtest requires cargo-expand"); - } - return; - } - let args = &["--all-features"]; - if is_ci { + if env::var_os("CI").is_some() { macrotest::expand_without_refresh_args(PATH, args); } else { env::set_var("MACROTEST", "overwrite"); macrotest::expand_args(PATH, args); } } - -fn has_command(command: &[&str]) -> bool { - Command::new(command[0]) - .args(&command[1..]) - .arg("--version") - .stdin(Stdio::null()) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status() - .as_ref() - .map(ExitStatus::success) - .unwrap_or(false) -}