Skip to content

Commit

Permalink
Bump Marker version -> v0.3 💯
Browse files Browse the repository at this point in the history
  • Loading branch information
xFrednet committed Oct 5, 2023
1 parent 77c0026 commit 31d54df
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 52 deletions.
61 changes: 33 additions & 28 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 --locked

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 --locked
- run: cargo doc --no-deps
- run: cargo marker -- --all-features --all-targets --locked
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 2 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/hello_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ fn something() {
}

fn main() {
println!("Hello, World!s");
println!("Hello, World!");
}
2 changes: 1 addition & 1 deletion tests/ui/hello_marker.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | }
| |_^
|
Expand Down
13 changes: 4 additions & 9 deletions tests/uitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
}

0 comments on commit 31d54df

Please sign in to comment.