about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-13 22:09:39 +0000
committerbors <bors@rust-lang.org>2020-01-13 22:09:39 +0000
commitc24a42289b50cb6bacb697b90aac2bbe747cdd97 (patch)
treec74cb6ec83db22e0acc4039912f5a2beb191e63c /src
parent05cb0df748dbc14c43dea4d627d68721a52861c6 (diff)
parentbba468887bb3c20ff8e38a61bb0f2222836cb451 (diff)
downloadrust-c24a42289b50cb6bacb697b90aac2bbe747cdd97.tar.gz
rust-c24a42289b50cb6bacb697b90aac2bbe747cdd97.zip
Auto merge of #4543 - xiongmao86:issue4503, r=flip1995
Fix issue4503

Fixes #4503.

changelog: Add a lint checking user are using FileType.is_file() method and suggest using !FileType.is_dir().

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`
Diffstat (limited to 'src')
-rw-r--r--src/lintlist/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index f576bb152de..9cad1ac786a 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -6,7 +6,7 @@ pub use lint::Lint;
 pub use lint::LINT_LEVELS;
 
 // begin lint list, do not remove this comment, it’s used in `update_lints`
-pub const ALL_LINTS: [Lint; 346] = [
+pub const ALL_LINTS: [Lint; 347] = [
     Lint {
         name: "absurd_extreme_comparisons",
         group: "correctness",
@@ -561,6 +561,13 @@ pub const ALL_LINTS: [Lint; 346] = [
         module: "fallible_impl_from",
     },
     Lint {
+        name: "filetype_is_file",
+        group: "restriction",
+        desc: "`FileType::is_file` is not recommended to test for readable file type",
+        deprecation: None,
+        module: "methods",
+    },
+    Lint {
         name: "filter_map",
         group: "pedantic",
         desc: "using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call",