Skip to content

Commit

Permalink
Add a regression test for #3
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman committed Apr 21, 2021
1 parent b4c77b0 commit 95f326a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/preserve_lint.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// See https://github.com/andrewhickman/fn-error-context
#![deny(dead_code)]

use fn_error_context::context;

#[context("context")]
fn do_stuff() -> anyhow::Result<()> {
anyhow::bail!("error")
}

fn main() {}
11 changes: 11 additions & 0 deletions tests/preserve_lint.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: function is never used: `do_stuff`
--> $DIR/preserve_lint.rs:7:4
|
7 | fn do_stuff() -> anyhow::Result<()> {
| ^^^^^^^^
|
note: the lint level is defined here
--> $DIR/preserve_lint.rs:2:9
|
2 | #![deny(dead_code)]
| ^^^^^^^^^
1 change: 1 addition & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ fn tests() {
tests.compile_fail("tests/fmt_unused_arg.rs");
tests.pass("tests/fmt_named_arg.rs");
tests.compile_fail("tests/async_without_return.rs");
tests.compile_fail("tests/preserve_lint.rs");
}

0 comments on commit 95f326a

Please sign in to comment.