Skip to content

Commit

Permalink
Extend spans to include !.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongmao86 committed Jan 12, 2020
1 parent bf9e6ca commit 8d333a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/mod.rs
Expand Up @@ -3275,7 +3275,7 @@ fn lint_filetype_is_file(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, args: &
then {
let lint_msg = "`!FileType::is_file()` does not deny all readable file types";
let help_msg = "use `FileType::is_dir()` instead";
span_help_and_lint(cx, FILETYPE_IS_FILE, expr.span, lint_msg, help_msg);
span_help_and_lint(cx, FILETYPE_IS_FILE, parent.span, lint_msg, help_msg);
} else {
let lint_msg = "`FileType::is_file()` does not cover all readable file types";
let help_msg = "use `!FileType::is_dir()` instead";
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/filetype_is_file.stderr
Expand Up @@ -8,10 +8,10 @@ LL | if fs::metadata("foo.txt")?.file_type().is_file() {
= help: use `!FileType::is_dir()` instead

error: `!FileType::is_file()` does not deny all readable file types
--> $DIR/filetype_is_file.rs:13:9
--> $DIR/filetype_is_file.rs:13:8
|
LL | if !fs::metadata("foo.txt")?.file_type().is_file() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `FileType::is_dir()` instead

Expand Down

0 comments on commit 8d333a3

Please sign in to comment.