From 9d6b7ce678ba68ba057e15b7d7641291c297a34e Mon Sep 17 00:00:00 2001 From: xFrednet Date: Thu, 5 Oct 2023 11:47:16 +0200 Subject: [PATCH] Bump Marker version -> `v0.3` :100: --- .github/workflows/rust.yml | 61 +++++++++++++++++++----------------- Cargo.toml | 8 ++--- rust-toolchain.toml | 2 +- src/lib.rs | 10 ++---- tests/ui/hello_marker.rs | 2 +- tests/ui/hello_marker.stderr | 2 +- tests/uitest.rs | 13 +++----- 7 files changed, 46 insertions(+), 52 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d7167f4..8992ac8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,18 +1,10 @@ on: push: - # Don't run tests, when only text files were modified - paths-ignore: - - 'COPYRIGHT' - - 'LICENSE-*' - - '**.md' - - '**.txt' pull_request: - # Don't run tests, when only text files were modified - paths-ignore: - - 'COPYRIGHT' - - 'LICENSE-*' - - '**.md' - - '**.txt' + +defaults: + run: + shell: bash env: RUST_BACKTRACE: 1 @@ -21,22 +13,35 @@ env: RUSTFLAGS: "-Dwarnings" jobs: - rust: + rust-test: runs-on: ubuntu-latest - # Setup steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2023-07-13 - components: cargo, clippy, rustfmt, rustc, rustc-dev, llvm-tools - - run: rustc -vV - - run: cargo install cargo_marker --version 0.2.1 - - run: cargo marker setup - - # Tests - - run: cargo test - - run: cargo clippy - - run: cargo fmt --check - - run: cargo marker + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + # Marker is required for UI tests + - uses: rust-marker/marker@v0.3 + with: + install-only: true + - run: cargo test + + rust-formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: cargo fmt --check + + rust-lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: rust-marker/marker@v0.3 + with: + install-only: true + + - run: cargo clippy --all-features --all-targets + - run: cargo doc --no-deps + - run: cargo marker -- --all-features --all-targets diff --git a/Cargo.toml b/Cargo.toml index 7acbdaf..c2db006 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,15 +9,15 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -marker_api = "0.2.1" -marker_utils = "0.2.1" +marker_api = "0.3" +marker_utils = "0.3" [dev-dependencies] -marker_uitest = "0.2.1" +marker_uitest = "0.3" [[test]] name = "uitest" harness = false [workspace.metadata.marker.lints] -marker_lints = "0.2.1" +marker_lints = "0.3" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6fabcf7..500d58d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # on the stable channel as usual [toolchain] -channel = "nightly-2023-07-13" +channel = "nightly-2023-08-24" components = ["cargo", "clippy", "rustc", "rustc-dev", "rustfmt", "llvm-tools"] diff --git a/src/lib.rs b/src/lib.rs index 4aba857..bbaee8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,17 +30,11 @@ impl LintPass for MyLintPass { LintPassInfoBuilder::new(Box::new([MY_LINT])).build() } - fn check_item<'ast>(&mut self, cx: &'ast AstContext<'ast>, item: ItemKind<'ast>) { + fn check_item<'ast>(&mut self, cx: &'ast MarkerContext<'ast>, item: ItemKind<'ast>) { if let ItemKind::Fn(func) = item { if let Some(ident) = func.ident() { if ident.name() == "main" { - cx.emit_lint( - MY_LINT, - item.id(), - "hello, main (From Marker)", - item.span(), - |_| {}, - ); + cx.emit_lint(MY_LINT, item, "hello, main (From Marker)"); } } } diff --git a/tests/ui/hello_marker.rs b/tests/ui/hello_marker.rs index dbbde4d..77f1309 100644 --- a/tests/ui/hello_marker.rs +++ b/tests/ui/hello_marker.rs @@ -3,5 +3,5 @@ fn something() { } fn main() { - println!("Hello, World!s"); + println!("Hello, World!"); } diff --git a/tests/ui/hello_marker.stderr b/tests/ui/hello_marker.stderr index e5f6f3e..89b7cd7 100644 --- a/tests/ui/hello_marker.stderr +++ b/tests/ui/hello_marker.stderr @@ -2,7 +2,7 @@ warning: hello, main (From Marker) --> $DIR/hello_marker.rs:5:1 | 5 | / fn main() { -6 | | println!("Hello, World!s"); +6 | | println!("Hello, World!"); 7 | | } | |_^ | diff --git a/tests/uitest.rs b/tests/uitest.rs index 0633a87..a9f2c68 100644 --- a/tests/uitest.rs +++ b/tests/uitest.rs @@ -8,18 +8,13 @@ fn main() -> color_eyre::Result<()> { // of a valid crate. The line below will use the `Cargo.toml` if this lint crate. // config.dependencies_crate_manifest_path = Some("./Cargo.toml".into()); - let bless = env::var_os("RUST_BLESS").is_some() || env::args().any(|arg| arg == "--bless"); - if bless { - config.output_conflict_handling = OutputConflictHandling::Bless - } - - config.stderr_filter(r"\\", "/"); - config.stdout_filter(r"\\", "/"); + config.filter(r"\\/", "/"); + config.filter(r"\\\\", "/"); run_tests_generic( - config, + vec![config], default_file_filter, default_per_file_config, - status_emitter::Text, + status_emitter::Text::quiet(), ) }