Skip to content

Commit 95f326a

Browse files
committed
Add a regression test for #3
1 parent b4c77b0 commit 95f326a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

tests/preserve_lint.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// See https://github.com/andrewhickman/fn-error-context
2+
#![deny(dead_code)]
3+
4+
use fn_error_context::context;
5+
6+
#[context("context")]
7+
fn do_stuff() -> anyhow::Result<()> {
8+
anyhow::bail!("error")
9+
}
10+
11+
fn main() {}

tests/preserve_lint.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: function is never used: `do_stuff`
2+
--> $DIR/preserve_lint.rs:7:4
3+
|
4+
7 | fn do_stuff() -> anyhow::Result<()> {
5+
| ^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/preserve_lint.rs:2:9
9+
|
10+
2 | #![deny(dead_code)]
11+
| ^^^^^^^^^

tests/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ fn tests() {
1616
tests.compile_fail("tests/fmt_unused_arg.rs");
1717
tests.pass("tests/fmt_named_arg.rs");
1818
tests.compile_fail("tests/async_without_return.rs");
19+
tests.compile_fail("tests/preserve_lint.rs");
1920
}

0 commit comments

Comments
 (0)