diff options
| author | xiongmao86 <xiongmao86dev@sina.com> | 2020-01-04 11:27:24 +0800 |
|---|---|---|
| committer | xiongmao86 <xiongmao86dev@sina.com> | 2020-01-12 19:54:17 +0800 |
| commit | 8d333a3cbbae57ce7813c1529fdf597ad258c931 (patch) | |
| tree | 28491576ef73514904a2de6a8cd34955e1859ebe | |
| parent | bf9e6ca9f62b0adee51708950ed2cb10e16a7c62 (diff) | |
| download | rust-8d333a3cbbae57ce7813c1529fdf597ad258c931.tar.gz rust-8d333a3cbbae57ce7813c1529fdf597ad258c931.zip | |
Extend spans to include !.
| -rw-r--r-- | clippy_lints/src/methods/mod.rs | 2 | ||||
| -rw-r--r-- | tests/ui/filetype_is_file.stderr | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index b833fb55157..a56334dc150 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -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"; diff --git a/tests/ui/filetype_is_file.stderr b/tests/ui/filetype_is_file.stderr index 298cb5ad065..08bebbd796e 100644 --- a/tests/ui/filetype_is_file.stderr +++ b/tests/ui/filetype_is_file.stderr @@ -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 |
