|
1 | 1 | mod bind_instead_of_map;
|
2 | 2 | mod bytes_nth;
|
3 | 3 | mod expect_used;
|
| 4 | +mod filetype_is_file; |
4 | 5 | mod filter_map_identity;
|
5 | 6 | mod filter_next;
|
6 | 7 | mod get_unwrap;
|
@@ -1725,7 +1726,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
1725 | 1726 | ["add" | "offset" | "sub" | "wrapping_offset" | "wrapping_add" | "wrapping_sub"] => {
|
1726 | 1727 | check_pointer_offset(cx, expr, arg_lists[0])
|
1727 | 1728 | },
|
1728 |
| - ["is_file", ..] => lint_filetype_is_file(cx, expr, arg_lists[0]), |
| 1729 | + ["is_file", ..] => filetype_is_file::check(cx, expr, arg_lists[0]), |
1729 | 1730 | ["map", "as_ref"] => {
|
1730 | 1731 | option_as_ref_deref::check(cx, expr, arg_lists[1], arg_lists[0], false, self.msrv.as_ref())
|
1731 | 1732 | },
|
@@ -3859,38 +3860,6 @@ fn check_pointer_offset(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir:
|
3859 | 3860 | }
|
3860 | 3861 | }
|
3861 | 3862 |
|
3862 |
| -fn lint_filetype_is_file(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) { |
3863 |
| - let ty = cx.typeck_results().expr_ty(&args[0]); |
3864 |
| - |
3865 |
| - if !match_type(cx, ty, &paths::FILE_TYPE) { |
3866 |
| - return; |
3867 |
| - } |
3868 |
| - |
3869 |
| - let span: Span; |
3870 |
| - let verb: &str; |
3871 |
| - let lint_unary: &str; |
3872 |
| - let help_unary: &str; |
3873 |
| - if_chain! { |
3874 |
| - if let Some(parent) = get_parent_expr(cx, expr); |
3875 |
| - if let hir::ExprKind::Unary(op, _) = parent.kind; |
3876 |
| - if op == hir::UnOp::Not; |
3877 |
| - then { |
3878 |
| - lint_unary = "!"; |
3879 |
| - verb = "denies"; |
3880 |
| - help_unary = ""; |
3881 |
| - span = parent.span; |
3882 |
| - } else { |
3883 |
| - lint_unary = ""; |
3884 |
| - verb = "covers"; |
3885 |
| - help_unary = "!"; |
3886 |
| - span = expr.span; |
3887 |
| - } |
3888 |
| - } |
3889 |
| - let lint_msg = format!("`{}FileType::is_file()` only {} regular files", lint_unary, verb); |
3890 |
| - let help_msg = format!("use `{}FileType::is_dir()` instead", help_unary); |
3891 |
| - span_lint_and_help(cx, FILETYPE_IS_FILE, span, &lint_msg, None, &help_msg); |
3892 |
| -} |
3893 |
| - |
3894 | 3863 | fn lint_from_iter(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<'_>]) {
|
3895 | 3864 | let ty = cx.typeck_results().expr_ty(expr);
|
3896 | 3865 | let arg_ty = cx.typeck_results().expr_ty(&args[0]);
|
|
0 commit comments