Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
98e433d7
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
98e433d7
编写于
12月 04, 2019
作者:
M
Matthias Krüger
提交者:
flip1995
12月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rustup to rust-lang/rust#66878
上级
c66cca44
变更
154
展开全部
隐藏空白更改
内联
并排
Showing
154 changed file
with
308 addition
and
151 deletion
+308
-151
clippy_lints/src/approx_const.rs
clippy_lints/src/approx_const.rs
+2
-1
clippy_lints/src/arithmetic.rs
clippy_lints/src/arithmetic.rs
+2
-1
clippy_lints/src/as_conversions.rs
clippy_lints/src/as_conversions.rs
+2
-1
clippy_lints/src/assertions_on_constants.rs
clippy_lints/src/assertions_on_constants.rs
+2
-1
clippy_lints/src/assign_ops.rs
clippy_lints/src/assign_ops.rs
+2
-1
clippy_lints/src/attrs.rs
clippy_lints/src/attrs.rs
+2
-1
clippy_lints/src/bit_mask.rs
clippy_lints/src/bit_mask.rs
+2
-1
clippy_lints/src/blacklisted_name.rs
clippy_lints/src/blacklisted_name.rs
+2
-1
clippy_lints/src/block_in_if_condition.rs
clippy_lints/src/block_in_if_condition.rs
+2
-1
clippy_lints/src/booleans.rs
clippy_lints/src/booleans.rs
+2
-1
clippy_lints/src/bytecount.rs
clippy_lints/src/bytecount.rs
+2
-1
clippy_lints/src/cargo_common_metadata.rs
clippy_lints/src/cargo_common_metadata.rs
+2
-1
clippy_lints/src/checked_conversions.rs
clippy_lints/src/checked_conversions.rs
+2
-1
clippy_lints/src/cognitive_complexity.rs
clippy_lints/src/cognitive_complexity.rs
+2
-1
clippy_lints/src/collapsible_if.rs
clippy_lints/src/collapsible_if.rs
+2
-1
clippy_lints/src/comparison_chain.rs
clippy_lints/src/comparison_chain.rs
+2
-1
clippy_lints/src/copies.rs
clippy_lints/src/copies.rs
+2
-1
clippy_lints/src/copy_iterator.rs
clippy_lints/src/copy_iterator.rs
+2
-1
clippy_lints/src/dbg_macro.rs
clippy_lints/src/dbg_macro.rs
+2
-1
clippy_lints/src/default_trait_access.rs
clippy_lints/src/default_trait_access.rs
+2
-1
clippy_lints/src/derive.rs
clippy_lints/src/derive.rs
+2
-1
clippy_lints/src/doc.rs
clippy_lints/src/doc.rs
+2
-1
clippy_lints/src/double_comparison.rs
clippy_lints/src/double_comparison.rs
+2
-1
clippy_lints/src/double_parens.rs
clippy_lints/src/double_parens.rs
+2
-1
clippy_lints/src/drop_bounds.rs
clippy_lints/src/drop_bounds.rs
+2
-1
clippy_lints/src/drop_forget_ref.rs
clippy_lints/src/drop_forget_ref.rs
+2
-1
clippy_lints/src/duration_subsec.rs
clippy_lints/src/duration_subsec.rs
+2
-1
clippy_lints/src/else_if_without_else.rs
clippy_lints/src/else_if_without_else.rs
+2
-1
clippy_lints/src/empty_enum.rs
clippy_lints/src/empty_enum.rs
+2
-1
clippy_lints/src/entry.rs
clippy_lints/src/entry.rs
+2
-1
clippy_lints/src/enum_clike.rs
clippy_lints/src/enum_clike.rs
+2
-1
clippy_lints/src/enum_glob_use.rs
clippy_lints/src/enum_glob_use.rs
+2
-1
clippy_lints/src/enum_variants.rs
clippy_lints/src/enum_variants.rs
+2
-1
clippy_lints/src/eq_op.rs
clippy_lints/src/eq_op.rs
+2
-1
clippy_lints/src/erasing_op.rs
clippy_lints/src/erasing_op.rs
+2
-1
clippy_lints/src/escape.rs
clippy_lints/src/escape.rs
+2
-1
clippy_lints/src/eta_reduction.rs
clippy_lints/src/eta_reduction.rs
+2
-1
clippy_lints/src/eval_order_dependence.rs
clippy_lints/src/eval_order_dependence.rs
+2
-1
clippy_lints/src/excessive_precision.rs
clippy_lints/src/excessive_precision.rs
+2
-1
clippy_lints/src/exit.rs
clippy_lints/src/exit.rs
+2
-1
clippy_lints/src/explicit_write.rs
clippy_lints/src/explicit_write.rs
+2
-1
clippy_lints/src/fallible_impl_from.rs
clippy_lints/src/fallible_impl_from.rs
+2
-1
clippy_lints/src/format.rs
clippy_lints/src/format.rs
+2
-1
clippy_lints/src/formatting.rs
clippy_lints/src/formatting.rs
+2
-1
clippy_lints/src/functions.rs
clippy_lints/src/functions.rs
+2
-1
clippy_lints/src/get_last_with_len.rs
clippy_lints/src/get_last_with_len.rs
+2
-1
clippy_lints/src/identity_conversion.rs
clippy_lints/src/identity_conversion.rs
+2
-1
clippy_lints/src/identity_op.rs
clippy_lints/src/identity_op.rs
+2
-1
clippy_lints/src/if_not_else.rs
clippy_lints/src/if_not_else.rs
+2
-1
clippy_lints/src/implicit_return.rs
clippy_lints/src/implicit_return.rs
+2
-1
clippy_lints/src/indexing_slicing.rs
clippy_lints/src/indexing_slicing.rs
+2
-1
clippy_lints/src/infallible_destructuring_match.rs
clippy_lints/src/infallible_destructuring_match.rs
+2
-1
clippy_lints/src/infinite_iter.rs
clippy_lints/src/infinite_iter.rs
+2
-1
clippy_lints/src/inherent_impl.rs
clippy_lints/src/inherent_impl.rs
+2
-1
clippy_lints/src/inherent_to_string.rs
clippy_lints/src/inherent_to_string.rs
+2
-1
clippy_lints/src/inline_fn_without_body.rs
clippy_lints/src/inline_fn_without_body.rs
+2
-1
clippy_lints/src/int_plus_one.rs
clippy_lints/src/int_plus_one.rs
+2
-1
clippy_lints/src/integer_division.rs
clippy_lints/src/integer_division.rs
+2
-1
clippy_lints/src/items_after_statements.rs
clippy_lints/src/items_after_statements.rs
+2
-1
clippy_lints/src/large_enum_variant.rs
clippy_lints/src/large_enum_variant.rs
+2
-1
clippy_lints/src/large_stack_arrays.rs
clippy_lints/src/large_stack_arrays.rs
+2
-1
clippy_lints/src/len_zero.rs
clippy_lints/src/len_zero.rs
+2
-1
clippy_lints/src/let_if_seq.rs
clippy_lints/src/let_if_seq.rs
+2
-1
clippy_lints/src/lib.rs
clippy_lints/src/lib.rs
+5
-1
clippy_lints/src/lifetimes.rs
clippy_lints/src/lifetimes.rs
+2
-1
clippy_lints/src/literal_representation.rs
clippy_lints/src/literal_representation.rs
+2
-1
clippy_lints/src/loops.rs
clippy_lints/src/loops.rs
+2
-1
clippy_lints/src/main_recursion.rs
clippy_lints/src/main_recursion.rs
+2
-1
clippy_lints/src/map_clone.rs
clippy_lints/src/map_clone.rs
+2
-1
clippy_lints/src/map_unit_fn.rs
clippy_lints/src/map_unit_fn.rs
+2
-1
clippy_lints/src/matches.rs
clippy_lints/src/matches.rs
+2
-1
clippy_lints/src/mem_discriminant.rs
clippy_lints/src/mem_discriminant.rs
+2
-1
clippy_lints/src/mem_forget.rs
clippy_lints/src/mem_forget.rs
+2
-1
clippy_lints/src/mem_replace.rs
clippy_lints/src/mem_replace.rs
+2
-1
clippy_lints/src/methods/mod.rs
clippy_lints/src/methods/mod.rs
+2
-1
clippy_lints/src/minmax.rs
clippy_lints/src/minmax.rs
+2
-1
clippy_lints/src/misc.rs
clippy_lints/src/misc.rs
+2
-1
clippy_lints/src/misc_early.rs
clippy_lints/src/misc_early.rs
+2
-1
clippy_lints/src/missing_const_for_fn.rs
clippy_lints/src/missing_const_for_fn.rs
+2
-1
clippy_lints/src/missing_doc.rs
clippy_lints/src/missing_doc.rs
+2
-1
clippy_lints/src/missing_inline.rs
clippy_lints/src/missing_inline.rs
+2
-1
clippy_lints/src/mul_add.rs
clippy_lints/src/mul_add.rs
+2
-1
clippy_lints/src/multiple_crate_versions.rs
clippy_lints/src/multiple_crate_versions.rs
+2
-1
clippy_lints/src/mut_mut.rs
clippy_lints/src/mut_mut.rs
+2
-1
clippy_lints/src/mut_reference.rs
clippy_lints/src/mut_reference.rs
+2
-1
clippy_lints/src/mutable_debug_assertion.rs
clippy_lints/src/mutable_debug_assertion.rs
+2
-1
clippy_lints/src/mutex_atomic.rs
clippy_lints/src/mutex_atomic.rs
+2
-1
clippy_lints/src/needless_bool.rs
clippy_lints/src/needless_bool.rs
+2
-1
clippy_lints/src/needless_borrow.rs
clippy_lints/src/needless_borrow.rs
+2
-1
clippy_lints/src/needless_borrowed_ref.rs
clippy_lints/src/needless_borrowed_ref.rs
+2
-1
clippy_lints/src/needless_continue.rs
clippy_lints/src/needless_continue.rs
+2
-1
clippy_lints/src/needless_pass_by_value.rs
clippy_lints/src/needless_pass_by_value.rs
+2
-1
clippy_lints/src/needless_update.rs
clippy_lints/src/needless_update.rs
+2
-1
clippy_lints/src/neg_cmp_op_on_partial_ord.rs
clippy_lints/src/neg_cmp_op_on_partial_ord.rs
+2
-1
clippy_lints/src/neg_multiply.rs
clippy_lints/src/neg_multiply.rs
+2
-1
clippy_lints/src/new_without_default.rs
clippy_lints/src/new_without_default.rs
+2
-1
clippy_lints/src/no_effect.rs
clippy_lints/src/no_effect.rs
+2
-1
clippy_lints/src/non_copy_const.rs
clippy_lints/src/non_copy_const.rs
+2
-1
clippy_lints/src/non_expressive_names.rs
clippy_lints/src/non_expressive_names.rs
+2
-1
clippy_lints/src/ok_if_let.rs
clippy_lints/src/ok_if_let.rs
+2
-1
clippy_lints/src/open_options.rs
clippy_lints/src/open_options.rs
+2
-1
clippy_lints/src/overflow_check_conditional.rs
clippy_lints/src/overflow_check_conditional.rs
+2
-1
clippy_lints/src/panic_unimplemented.rs
clippy_lints/src/panic_unimplemented.rs
+2
-1
clippy_lints/src/partialeq_ne_impl.rs
clippy_lints/src/partialeq_ne_impl.rs
+2
-1
clippy_lints/src/path_buf_push_overwrite.rs
clippy_lints/src/path_buf_push_overwrite.rs
+2
-1
clippy_lints/src/precedence.rs
clippy_lints/src/precedence.rs
+2
-1
clippy_lints/src/ptr.rs
clippy_lints/src/ptr.rs
+2
-1
clippy_lints/src/ptr_offset_with_cast.rs
clippy_lints/src/ptr_offset_with_cast.rs
+2
-1
clippy_lints/src/question_mark.rs
clippy_lints/src/question_mark.rs
+2
-1
clippy_lints/src/ranges.rs
clippy_lints/src/ranges.rs
+2
-1
clippy_lints/src/redundant_clone.rs
clippy_lints/src/redundant_clone.rs
+2
-1
clippy_lints/src/redundant_field_names.rs
clippy_lints/src/redundant_field_names.rs
+2
-1
clippy_lints/src/redundant_pattern_matching.rs
clippy_lints/src/redundant_pattern_matching.rs
+2
-1
clippy_lints/src/redundant_static_lifetimes.rs
clippy_lints/src/redundant_static_lifetimes.rs
+2
-1
clippy_lints/src/reference.rs
clippy_lints/src/reference.rs
+2
-1
clippy_lints/src/regex.rs
clippy_lints/src/regex.rs
+2
-1
clippy_lints/src/replace_consts.rs
clippy_lints/src/replace_consts.rs
+2
-1
clippy_lints/src/returns.rs
clippy_lints/src/returns.rs
+2
-1
clippy_lints/src/serde_api.rs
clippy_lints/src/serde_api.rs
+2
-1
clippy_lints/src/shadow.rs
clippy_lints/src/shadow.rs
+2
-1
clippy_lints/src/slow_vector_initialization.rs
clippy_lints/src/slow_vector_initialization.rs
+2
-1
clippy_lints/src/strings.rs
clippy_lints/src/strings.rs
+2
-1
clippy_lints/src/suspicious_trait_impl.rs
clippy_lints/src/suspicious_trait_impl.rs
+2
-1
clippy_lints/src/swap.rs
clippy_lints/src/swap.rs
+2
-1
clippy_lints/src/tabs_in_doc_comments.rs
clippy_lints/src/tabs_in_doc_comments.rs
+2
-1
clippy_lints/src/temporary_assignment.rs
clippy_lints/src/temporary_assignment.rs
+2
-1
clippy_lints/src/to_digit_is_some.rs
clippy_lints/src/to_digit_is_some.rs
+2
-1
clippy_lints/src/trait_bounds.rs
clippy_lints/src/trait_bounds.rs
+2
-1
clippy_lints/src/transmute.rs
clippy_lints/src/transmute.rs
+2
-1
clippy_lints/src/transmuting_null.rs
clippy_lints/src/transmuting_null.rs
+2
-1
clippy_lints/src/trivially_copy_pass_by_ref.rs
clippy_lints/src/trivially_copy_pass_by_ref.rs
+2
-1
clippy_lints/src/try_err.rs
clippy_lints/src/try_err.rs
+2
-1
clippy_lints/src/types.rs
clippy_lints/src/types.rs
+2
-1
clippy_lints/src/unicode.rs
clippy_lints/src/unicode.rs
+2
-1
clippy_lints/src/unsafe_removed_from_name.rs
clippy_lints/src/unsafe_removed_from_name.rs
+2
-1
clippy_lints/src/unused_io_amount.rs
clippy_lints/src/unused_io_amount.rs
+2
-1
clippy_lints/src/unused_label.rs
clippy_lints/src/unused_label.rs
+2
-1
clippy_lints/src/unused_self.rs
clippy_lints/src/unused_self.rs
+2
-1
clippy_lints/src/unwrap.rs
clippy_lints/src/unwrap.rs
+2
-1
clippy_lints/src/use_self.rs
clippy_lints/src/use_self.rs
+2
-1
clippy_lints/src/utils/author.rs
clippy_lints/src/utils/author.rs
+2
-1
clippy_lints/src/utils/inspector.rs
clippy_lints/src/utils/inspector.rs
+2
-1
clippy_lints/src/utils/internal_lints.rs
clippy_lints/src/utils/internal_lints.rs
+2
-1
clippy_lints/src/utils/paths.rs
clippy_lints/src/utils/paths.rs
+1
-1
clippy_lints/src/vec.rs
clippy_lints/src/vec.rs
+2
-1
clippy_lints/src/wildcard_dependencies.rs
clippy_lints/src/wildcard_dependencies.rs
+2
-1
clippy_lints/src/write.rs
clippy_lints/src/write.rs
+2
-1
clippy_lints/src/zero_div_zero.rs
clippy_lints/src/zero_div_zero.rs
+2
-1
doc/adding_lints.md
doc/adding_lints.md
+2
-1
tests/ui/lint_without_lint_pass.rs
tests/ui/lint_without_lint_pass.rs
+2
-0
tests/ui/lint_without_lint_pass.stderr
tests/ui/lint_without_lint_pass.stderr
+1
-1
tests/ui/outer_expn_data.fixed
tests/ui/outer_expn_data.fixed
+2
-0
tests/ui/outer_expn_data.rs
tests/ui/outer_expn_data.rs
+2
-0
tests/ui/outer_expn_data.stderr
tests/ui/outer_expn_data.stderr
+1
-1
未找到文件。
clippy_lints/src/approx_const.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
std
::
f64
::
consts
as
f64
;
use
syntax
::
ast
::{
FloatTy
,
LitFloatType
,
LitKind
};
use
syntax
::
symbol
;
...
...
clippy_lints/src/arithmetic.rs
浏览文件 @
98e433d7
use
crate
::
consts
::
constant_simple
;
use
crate
::
utils
::
span_lint
;
use
rustc
::
hir
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/as_conversions.rs
浏览文件 @
98e433d7
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
crate
::
utils
::
span_help_and_lint
;
...
...
clippy_lints/src/assertions_on_constants.rs
浏览文件 @
98e433d7
...
...
@@ -2,9 +2,10 @@
use
crate
::
utils
::
paths
;
use
crate
::
utils
::{
is_direct_expn_of
,
is_expn_of
,
match_function_call
,
snippet_opt
,
span_help_and_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
declare_clippy_lint!
{
...
...
clippy_lints/src/assign_ops.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
crate
::
utils
::{
get_trait_def_id
,
implements_trait
,
snippet_opt
,
span_lint_and_then
,
trait_ref_of_method
,
SpanlessEq
,
...
...
clippy_lints/src/attrs.rs
浏览文件 @
98e433d7
...
...
@@ -6,14 +6,15 @@
span_lint_and_then
,
without_block_comments
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
CheckLintNameResult
,
EarlyContext
,
EarlyLintPass
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
,
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
semver
::
Version
;
use
syntax
::
ast
::{
AttrKind
,
AttrStyle
,
Attribute
,
Lit
,
LitKind
,
MetaItemKind
,
NestedMetaItem
};
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/bit_mask.rs
浏览文件 @
98e433d7
...
...
@@ -3,9 +3,10 @@
use
crate
::
utils
::{
span_lint
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/blacklisted_name.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for usage of blacklisted names for variables, such
...
...
clippy_lints/src/block_in_if_condition.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
*
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for `if` conditions that use blocks to contain an
...
...
clippy_lints/src/booleans.rs
浏览文件 @
98e433d7
...
...
@@ -3,11 +3,12 @@
span_lint_and_then
,
SpanlessEq
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::
*
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/bytecount.rs
浏览文件 @
98e433d7
...
...
@@ -3,11 +3,12 @@
span_lint_and_sugg
,
walk_ptrs_ty
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::{
Name
,
UintTy
};
declare_clippy_lint!
{
...
...
clippy_lints/src/cargo_common_metadata.rs
浏览文件 @
98e433d7
...
...
@@ -3,8 +3,9 @@
use
std
::
path
::
PathBuf
;
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::{
ast
::
*
,
source_map
::
DUMMY_SP
};
use
cargo_metadata
;
...
...
clippy_lints/src/checked_conversions.rs
浏览文件 @
98e433d7
//! lint on manually implemented checked conversions that could be transformed into `try_from`
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
crate
::
utils
::{
snippet_with_applicability
,
span_lint_and_sugg
,
SpanlessEq
};
...
...
clippy_lints/src/cognitive_complexity.rs
浏览文件 @
98e433d7
...
...
@@ -2,8 +2,9 @@
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
Attribute
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/collapsible_if.rs
浏览文件 @
98e433d7
...
...
@@ -13,8 +13,9 @@
//! This lint is **warn** by default
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
;
use
crate
::
utils
::
sugg
::
Sugg
;
...
...
clippy_lints/src/comparison_chain.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
get_trait_def_id
,
if_sequence
,
implements_trait
,
parent_node_is_if_expr
,
paths
,
span_help_and_lint
,
SpanlessEq
,
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks comparison chains written with `if` that can be
...
...
clippy_lints/src/copies.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
get_parent_expr
,
higher
,
if_sequence
,
same_tys
,
snippet
,
span_lint_and_then
,
span_note_and_lint
};
use
crate
::
utils
::{
SpanlessEq
,
SpanlessHash
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::
Ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
collections
::
hash_map
::
Entry
;
use
std
::
hash
::
BuildHasherDefault
;
use
syntax
::
symbol
::
Symbol
;
...
...
clippy_lints/src/copy_iterator.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
is_copy
,
match_path
,
paths
,
span_note_and_lint
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
Item
,
ItemKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for types that implement `Copy` as well as
...
...
clippy_lints/src/dbg_macro.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
snippet_opt
,
span_help_and_lint
,
span_lint_and_sugg
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
;
use
syntax
::
source_map
::
Span
;
use
syntax
::
tokenstream
::
TokenStream
;
...
...
clippy_lints/src/default_trait_access.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
crate
::
utils
::{
any_parent_is_automatically_derived
,
match_def_path
,
paths
,
span_lint_and_sugg
};
...
...
clippy_lints/src/derive.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
paths
;
use
crate
::
utils
::{
is_automatically_derived
,
is_copy
,
match_path
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/doc.rs
浏览文件 @
98e433d7
...
...
@@ -2,9 +2,10 @@
use
itertools
::
Itertools
;
use
pulldown_cmark
;
use
rustc
::
hir
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
ops
::
Range
;
use
syntax
::
ast
::{
AttrKind
,
Attribute
};
use
syntax
::
source_map
::{
BytePos
,
Span
};
...
...
clippy_lints/src/double_comparison.rs
浏览文件 @
98e433d7
//! Lint on unnecessary double comparisons. Some examples:
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
use
crate
::
utils
::{
snippet_with_applicability
,
span_lint_and_sugg
,
SpanlessEq
};
...
...
clippy_lints/src/double_parens.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
declare_clippy_lint!
{
...
...
clippy_lints/src/drop_bounds.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
match_def_path
,
paths
,
span_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for generics with `std::ops::Drop` as bounds.
...
...
clippy_lints/src/drop_forget_ref.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
is_copy
,
match_def_path
,
paths
,
qpath_res
,
span_note_and_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for calls to `std::mem::drop` with a reference
...
...
clippy_lints/src/duration_subsec.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Spanned
;
use
crate
::
consts
::{
constant
,
Constant
};
...
...
clippy_lints/src/else_if_without_else.rs
浏览文件 @
98e433d7
//! Lint on if expressions with an else if, but without a final else branch.
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
crate
::
utils
::
span_help_and_lint
;
...
...
clippy_lints/src/empty_enum.rs
浏览文件 @
98e433d7
//! lint when there is an enum with no variants
use
crate
::
utils
::
span_lint_and_then
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for `enum`s with no variants.
...
...
clippy_lints/src/entry.rs
浏览文件 @
98e433d7
...
...
@@ -2,11 +2,12 @@
use
crate
::
utils
::{
get_item_name
,
higher
,
match_type
,
paths
,
snippet
,
snippet_opt
};
use
crate
::
utils
::{
snippet_with_applicability
,
span_lint_and_then
,
walk_ptrs_ty
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/enum_clike.rs
浏览文件 @
98e433d7
...
...
@@ -3,13 +3,14 @@
use
crate
::
consts
::{
miri_to_const
,
Constant
};
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
mir
::
interpret
::
GlobalId
;
use
rustc
::
ty
;
use
rustc
::
ty
::
subst
::
InternalSubsts
;
use
rustc
::
ty
::
util
::
IntTypeExt
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
std
::
convert
::
TryFrom
;
use
syntax
::
ast
::{
IntTy
,
UintTy
};
...
...
clippy_lints/src/enum_glob_use.rs
浏览文件 @
98e433d7
//! lint on `use`ing all variants of an enum
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::{
DefKind
,
Res
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/enum_variants.rs
浏览文件 @
98e433d7
...
...
@@ -2,8 +2,9 @@
use
crate
::
utils
::{
camel_case
,
is_present_in_source
};
use
crate
::
utils
::{
span_help_and_lint
,
span_lint
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
Lint
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
syntax
::
source_map
::
Span
;
use
syntax
::
symbol
::
Symbol
;
...
...
clippy_lints/src/eq_op.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
implements_trait
,
is_copy
,
multispan_sugg
,
snippet
,
span_lint
,
span_lint_and_then
,
SpanlessEq
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for equal operands to comparison, logical and
...
...
clippy_lints/src/erasing_op.rs
浏览文件 @
98e433d7
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
use
crate
::
consts
::{
constant_simple
,
Constant
};
...
...
clippy_lints/src/escape.rs
浏览文件 @
98e433d7
use
rustc
::
hir
::
intravisit
as
visit
;
use
rustc
::
hir
::{
self
,
*
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::
layout
::
LayoutOf
;
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::
util
::
nodemap
::
HirIdSet
;
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
rustc_typeck
::
expr_use_visitor
::
*
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/eta_reduction.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
crate
::
utils
::{
implements_trait
,
is_adjusted
,
iter_input_pats
,
snippet_opt
,
span_lint_and_then
,
type_is_unsafe_function
,
...
...
clippy_lints/src/eval_order_dependence.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
get_parent_expr
,
span_lint
,
span_note_and_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for a read and a write to the same variable where
...
...
clippy_lints/src/excessive_precision.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint_and_sugg
;
use
crate
::
utils
::
sugg
::
format_numeric_literal
;
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
f32
;
use
std
::
f64
;
use
std
::
fmt
;
...
...
clippy_lints/src/exit.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
is_entrypoint_fn
,
match_def_path
,
paths
,
qpath_res
,
span_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
Expr
,
ExprKind
,
Item
,
ItemKind
,
Node
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** `exit()` terminates the program and doesn't provide a
...
...
clippy_lints/src/explicit_write.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
is_expn_of
,
match_function_call
,
paths
,
span_lint
,
span_lint_and_sugg
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
declare_clippy_lint!
{
...
...
clippy_lints/src/fallible_impl_from.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
paths
::{
BEGIN_PANIC
,
BEGIN_PANIC_FMT
,
FROM_TRAIT
,
OPTION
,
RESULT
};
use
crate
::
utils
::{
is_expn_of
,
match_def_path
,
method_chain_args
,
span_lint_and_then
,
walk_ptrs_ty
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax_pos
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/format.rs
浏览文件 @
98e433d7
...
...
@@ -4,10 +4,11 @@
walk_ptrs_ty
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/formatting.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
differing_macro_contexts
,
snippet_opt
,
span_help_and_lint
,
span_note_and_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
declare_clippy_lint!
{
...
...
clippy_lints/src/functions.rs
浏览文件 @
98e433d7
...
...
@@ -4,11 +4,12 @@
};
use
matches
::
matches
;
use
rustc
::
hir
::{
self
,
def
::
Res
,
def_id
::
DefId
,
intravisit
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
rustc_target
::
spec
::
abi
::
Abi
;
use
syntax
::
ast
::
Attribute
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/get_last_with_len.rs
浏览文件 @
98e433d7
...
...
@@ -2,10 +2,11 @@
use
crate
::
utils
::{
is_type_diagnostic_item
,
snippet_with_applicability
,
span_lint_and_sugg
,
SpanlessEq
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
BinOpKind
,
Expr
,
ExprKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::
Spanned
;
use
syntax
::
symbol
::
Symbol
;
...
...
clippy_lints/src/identity_conversion.rs
浏览文件 @
98e433d7
...
...
@@ -2,9 +2,10 @@
match_def_path
,
match_trait_method
,
paths
,
same_tys
,
snippet
,
snippet_with_macro_callsite
,
span_lint_and_then
,
};
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for always-identical `Into`/`From`/`IntoIter` conversions.
...
...
clippy_lints/src/identity_op.rs
浏览文件 @
98e433d7
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
use
crate
::
consts
::{
constant_simple
,
Constant
};
...
...
clippy_lints/src/if_not_else.rs
浏览文件 @
98e433d7
//! lint on if branches that could be swapped so no `!` operation is necessary
//! on the condition
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
crate
::
utils
::
span_help_and_lint
;
...
...
clippy_lints/src/implicit_return.rs
浏览文件 @
98e433d7
...
...
@@ -5,11 +5,12 @@
};
use
if_chain
::
if_chain
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
,
declare_lint_pass
,
hir
::{
intravisit
::
FnKind
,
Body
,
Expr
,
ExprKind
,
FnDecl
,
HirId
,
MatchSource
,
StmtKind
},
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
},
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/indexing_slicing.rs
浏览文件 @
98e433d7
...
...
@@ -4,10 +4,11 @@
use
crate
::
utils
;
use
crate
::
utils
::
higher
;
use
crate
::
utils
::
higher
::
Range
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
RangeLimits
;
declare_clippy_lint!
{
...
...
clippy_lints/src/infallible_destructuring_match.rs
浏览文件 @
98e433d7
use
super
::
utils
::{
get_arg_name
,
match_var
,
remove_blocks
,
snippet_with_applicability
,
span_lint_and_sugg
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for matches being used to destructure a single-variant enum
...
...
clippy_lints/src/infinite_iter.rs
浏览文件 @
98e433d7
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
crate
::
utils
::{
get_trait_def_id
,
higher
,
implements_trait
,
match_qpath
,
match_type
,
paths
,
span_lint
};
...
...
clippy_lints/src/inherent_impl.rs
浏览文件 @
98e433d7
...
...
@@ -2,9 +2,10 @@
use
crate
::
utils
::{
in_macro
,
span_lint_and_then
};
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_session
::
declare_tool_lint
;
use
syntax_pos
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/inherent_to_string.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
ImplItem
,
ImplItemKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
crate
::
utils
::{
get_trait_def_id
,
implements_trait
,
match_type
,
paths
,
return_ty
,
span_help_and_lint
,
trait_ref_of_method
,
...
...
clippy_lints/src/inline_fn_without_body.rs
浏览文件 @
98e433d7
...
...
@@ -2,10 +2,11 @@
use
crate
::
utils
::
span_lint_and_then
;
use
crate
::
utils
::
sugg
::
DiagnosticBuilderExt
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::{
Attribute
,
Name
};
declare_clippy_lint!
{
...
...
clippy_lints/src/int_plus_one.rs
浏览文件 @
98e433d7
//! lint on blocks unnecessarily using >= with a + 1 or - 1
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
crate
::
utils
::{
snippet_opt
,
span_lint_and_then
};
...
...
clippy_lints/src/integer_division.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_help_and_lint
;
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for division of integers
...
...
clippy_lints/src/items_after_statements.rs
浏览文件 @
98e433d7
...
...
@@ -2,8 +2,9 @@
use
crate
::
utils
::
span_lint
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
declare_clippy_lint!
{
...
...
clippy_lints/src/large_enum_variant.rs
浏览文件 @
98e433d7
...
...
@@ -2,10 +2,11 @@
use
crate
::
utils
::{
snippet_opt
,
span_lint_and_then
};
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::
layout
::
LayoutOf
;
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for large size differences between variants on
...
...
clippy_lints/src/large_stack_arrays.rs
浏览文件 @
98e433d7
use
rustc
::
hir
::
*
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
mir
::
interpret
::
ConstValue
;
use
rustc
::
ty
::{
self
,
ConstKind
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
if_chain
::
if_chain
;
...
...
clippy_lints/src/len_zero.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
get_item_name
,
snippet_with_applicability
,
span_lint
,
span_lint_and_sugg
,
walk_ptrs_ty
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::{
LitKind
,
Name
};
use
syntax
::
source_map
::{
Span
,
Spanned
};
...
...
clippy_lints/src/let_if_seq.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
higher
,
qpath_res
,
snippet
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
hir
::
def
::
Res
;
use
rustc
::
hir
::
BindingAnnotation
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for variable declarations immediately followed by a
...
...
clippy_lints/src/lib.rs
浏览文件 @
98e433d7
...
...
@@ -35,6 +35,8 @@
#[allow(unused_extern_crates)]
extern
crate
rustc_parse
;
#[allow(unused_extern_crates)]
extern
crate
rustc_session
;
#[allow(unused_extern_crates)]
extern
crate
rustc_target
;
#[allow(unused_extern_crates)]
extern
crate
rustc_typeck
;
...
...
@@ -69,9 +71,11 @@
/// # #![feature(rustc_private)]
/// # #[allow(unused_extern_crates)]
/// # extern crate rustc;
/// # #[allow(unused_extern_crates)]
/// # extern crate rustc_session;
/// # #[macro_use]
/// # use clippy_lints::declare_clippy_lint;
/// use rustc::declare_tool_lint;
/// use rustc
_session
::declare_tool_lint;
///
/// declare_clippy_lint! {
/// /// **What it does:** Checks for ... (describe what the lint matches).
...
...
clippy_lints/src/lifetimes.rs
浏览文件 @
98e433d7
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::{
DefKind
,
Res
};
use
rustc
::
hir
::
intravisit
::
*
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxHashSet
};
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
use
syntax
::
symbol
::
kw
;
...
...
clippy_lints/src/literal_representation.rs
浏览文件 @
98e433d7
...
...
@@ -4,8 +4,9 @@
use
crate
::
utils
::{
in_macro
,
snippet_opt
,
span_lint_and_sugg
};
use
if_chain
::
if_chain
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
,
impl_lint_pass
};
use
rustc
::{
declare_lint_pass
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
syntax_pos
;
...
...
clippy_lints/src/loops.rs
浏览文件 @
98e433d7
use
crate
::
reexport
::
*
;
use
if_chain
::
if_chain
;
use
itertools
::
Itertools
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::{
DefKind
,
Res
};
use
rustc
::
hir
::
def_id
;
use
rustc
::
hir
::
intravisit
::{
walk_block
,
walk_expr
,
walk_pat
,
walk_stmt
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
middle
::
region
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
// use rustc::middle::region::CodeExtent;
use
crate
::
consts
::{
constant
,
Constant
};
use
crate
::
utils
::
usage
::
mutated_variables
;
...
...
clippy_lints/src/main_recursion.rs
浏览文件 @
98e433d7
use
rustc
::
hir
::{
Crate
,
Expr
,
ExprKind
,
QPath
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::
AttrKind
;
use
syntax
::
symbol
::
sym
;
...
...
clippy_lints/src/map_clone.rs
浏览文件 @
98e433d7
...
...
@@ -3,11 +3,12 @@
is_copy
,
match_trait_method
,
match_type
,
remove_blocks
,
snippet_with_applicability
,
span_lint_and_sugg
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
Ident
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/map_unit_fn.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
paths
;
use
crate
::
utils
::{
iter_input_pats
,
match_type
,
method_chain_args
,
snippet
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/matches.rs
浏览文件 @
98e433d7
...
...
@@ -6,12 +6,13 @@
snippet_with_applicability
,
span_lint_and_sugg
,
span_lint_and_then
,
span_note_and_lint
,
walk_ptrs_ty
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::
CtorKind
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
cmp
::
Ordering
;
use
std
::
collections
::
Bound
;
use
syntax
::
ast
::
LitKind
;
...
...
clippy_lints/src/mem_discriminant.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
match_def_path
,
paths
,
snippet
,
span_lint_and_then
,
walk_ptrs_ty_depth
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
BorrowKind
,
Expr
,
ExprKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
iter
;
...
...
clippy_lints/src/mem_forget.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
match_def_path
,
paths
,
qpath_res
,
span_lint
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
Expr
,
ExprKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for usage of `std::mem::forget(t)` where `t` is
...
...
clippy_lints/src/mem_replace.rs
浏览文件 @
98e433d7
...
...
@@ -2,10 +2,11 @@
match_def_path
,
match_qpath
,
paths
,
snippet_with_applicability
,
span_help_and_lint
,
span_lint_and_sugg
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
BorrowKind
,
Expr
,
ExprKind
,
Mutability
,
QPath
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for `mem::replace()` on an `Option` with
...
...
clippy_lints/src/methods/mod.rs
浏览文件 @
98e433d7
...
...
@@ -9,12 +9,13 @@
use
if_chain
::
if_chain
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
hir
::
intravisit
::{
self
,
Visitor
};
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
Lint
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
::{
self
,
Predicate
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
;
use
syntax
::
source_map
::
Span
;
use
syntax
::
symbol
::{
sym
,
Symbol
,
SymbolStr
};
...
...
clippy_lints/src/minmax.rs
浏览文件 @
98e433d7
use
crate
::
consts
::{
constant_simple
,
Constant
};
use
crate
::
utils
::{
match_def_path
,
paths
,
span_lint
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
std
::
cmp
::
Ordering
;
declare_clippy_lint!
{
...
...
clippy_lints/src/misc.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::
FnKind
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::{
ExpnKind
,
Span
};
...
...
clippy_lints/src/misc_early.rs
浏览文件 @
98e433d7
...
...
@@ -3,10 +3,11 @@
span_lint_and_then
,
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
*
;
use
syntax
::
source_map
::
Span
;
use
syntax
::
visit
::{
walk_expr
,
FnKind
,
Visitor
};
...
...
clippy_lints/src/missing_const_for_fn.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
has_drop
,
is_entrypoint_fn
,
span_lint
,
trait_ref_of_method
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
hir
::
intravisit
::
FnKind
;
use
rustc
::
hir
::{
Body
,
Constness
,
FnDecl
,
HirId
,
HirVec
};
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_mir
::
transform
::
qualify_min_const_fn
::
is_min_const_fn
;
use
rustc_session
::
declare_tool_lint
;
use
rustc_typeck
::
hir_ty_to_ty
;
use
syntax_pos
::
Span
;
...
...
clippy_lints/src/missing_doc.rs
浏览文件 @
98e433d7
...
...
@@ -8,9 +8,10 @@
use
crate
::
utils
::
span_lint
;
use
if_chain
::
if_chain
;
use
rustc
::
hir
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
::{
self
,
MetaItem
,
MetaItemKind
};
use
syntax
::
attr
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/missing_inline.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
lint
::{
self
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
;
use
syntax
::
source_map
::
Span
;
...
...
clippy_lints/src/mul_add.rs
浏览文件 @
98e433d7
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
crate
::
utils
::
*
;
...
...
clippy_lints/src/multiple_crate_versions.rs
浏览文件 @
98e433d7
//! lint on multiple versions of a crate being used
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::{
ast
::
*
,
source_map
::
DUMMY_SP
};
use
cargo_metadata
;
...
...
clippy_lints/src/mut_mut.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
higher
,
span_lint
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
;
use
rustc
::
hir
::
intravisit
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for instances of `mut mut` references.
...
...
clippy_lints/src/mut_reference.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::
subst
::
Subst
;
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Detects giving a mutable reference to a function that only
...
...
clippy_lints/src/mutable_debug_assertion.rs
浏览文件 @
98e433d7
...
...
@@ -4,7 +4,8 @@
use
rustc
::
hir
::
intravisit
::{
walk_expr
,
NestedVisitorMap
,
Visitor
};
use
rustc
::
hir
::{
BorrowKind
,
Expr
,
ExprKind
,
Mutability
,
StmtKind
,
UnOp
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
,
ty
};
use
rustc
::{
declare_lint_pass
,
ty
};
use
rustc_session
::
declare_tool_lint
;
use
syntax_pos
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/mutex_atomic.rs
浏览文件 @
98e433d7
...
...
@@ -3,10 +3,11 @@
//! This lint is **warn** by default
use
crate
::
utils
::{
match_type
,
paths
,
span_lint
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
Expr
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
ast
;
declare_clippy_lint!
{
...
...
clippy_lints/src/needless_bool.rs
浏览文件 @
98e433d7
...
...
@@ -4,10 +4,11 @@
use
crate
::
utils
::
sugg
::
Sugg
;
use
crate
::
utils
::{
higher
,
parent_node_is_if_expr
,
span_lint
,
span_lint_and_sugg
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
ast
::
LitKind
;
use
syntax
::
source_map
::
Spanned
;
...
...
clippy_lints/src/needless_borrow.rs
浏览文件 @
98e433d7
...
...
@@ -5,11 +5,12 @@
use
crate
::
utils
::{
snippet_opt
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
hir
::{
BindingAnnotation
,
BorrowKind
,
Expr
,
ExprKind
,
HirId
,
Item
,
Mutability
,
Pat
,
PatKind
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::
ty
::
adjustment
::{
Adjust
,
Adjustment
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for address of operations (`&`) that are going to
...
...
clippy_lints/src/needless_borrowed_ref.rs
浏览文件 @
98e433d7
...
...
@@ -4,10 +4,11 @@
use
crate
::
utils
::{
snippet_with_applicability
,
span_lint_and_then
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
BindingAnnotation
,
Mutability
,
Node
,
Pat
,
PatKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for useless borrowed references.
...
...
clippy_lints/src/needless_continue.rs
浏览文件 @
98e433d7
...
...
@@ -33,8 +33,9 @@
//! ```
//!
//! This lint is **warn** by default.
use
rustc
::
declare_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
std
::
borrow
::
Cow
;
use
syntax
::
ast
;
use
syntax
::
source_map
::{
original_sp
,
DUMMY_SP
};
...
...
clippy_lints/src/needless_pass_by_value.rs
浏览文件 @
98e433d7
...
...
@@ -5,14 +5,15 @@
};
use
if_chain
::
if_chain
;
use
matches
::
matches
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
intravisit
::
FnKind
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
traits
;
use
rustc
::
ty
::{
self
,
RegionKind
,
TypeFoldable
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxHashSet
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
rustc_target
::
spec
::
abi
::
Abi
;
use
rustc_typeck
::
expr_use_visitor
as
euv
;
use
std
::
borrow
::
Cow
;
...
...
clippy_lints/src/needless_update.rs
浏览文件 @
98e433d7
use
crate
::
utils
::
span_lint
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::{
Expr
,
ExprKind
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::
ty
;
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:** Checks for needlessly including a base struct on update
...
...
clippy_lints/src/neg_cmp_op_on_partial_ord.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
crate
::
utils
::{
self
,
paths
,
span_lint
};
...
...
clippy_lints/src/neg_multiply.rs
浏览文件 @
98e433d7
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
use
crate
::
consts
::{
self
,
Constant
};
...
...
clippy_lints/src/new_without_default.rs
浏览文件 @
98e433d7
...
...
@@ -4,11 +4,12 @@
use
if_chain
::
if_chain
;
use
rustc
::
hir
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
in_external_macro
,
LateContext
,
LateLintPass
,
LintArray
,
LintContext
,
LintPass
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::
util
::
nodemap
::
HirIdSet
;
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
syntax
::
source_map
::
Span
;
declare_clippy_lint!
{
...
...
clippy_lints/src/no_effect.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
has_drop
,
qpath_res
,
snippet_opt
,
span_lint
,
span_lint_and_sugg
};
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::{
DefKind
,
Res
};
use
rustc
::
hir
::{
BinOpKind
,
BlockCheckMode
,
Expr
,
ExprKind
,
Stmt
,
StmtKind
,
UnsafeSource
};
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
};
use
rustc_errors
::
Applicability
;
use
rustc_session
::
declare_tool_lint
;
use
std
::
ops
::
Deref
;
declare_clippy_lint!
{
...
...
clippy_lints/src/non_copy_const.rs
浏览文件 @
98e433d7
...
...
@@ -4,12 +4,13 @@
use
std
::
ptr
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
def
::{
DefKind
,
Res
};
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
Lint
,
LintArray
,
LintPass
};
use
rustc
::
ty
::
adjustment
::
Adjust
;
use
rustc
::
ty
::{
Ty
,
TypeFlags
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
use
rustc_typeck
::
hir_ty_to_ty
;
use
syntax_pos
::{
InnerSpan
,
Span
,
DUMMY_SP
};
...
...
clippy_lints/src/non_expressive_names.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
span_lint
,
span_lint_and_then
};
use
rustc
::
impl_lint_pass
;
use
rustc
::
lint
::{
EarlyContext
,
EarlyLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_tool_lint
,
impl_lint_pass
}
;
use
rustc
_session
::
declare_tool_lint
;
use
std
::
cmp
::
Ordering
;
use
syntax
::
ast
::
*
;
use
syntax
::
attr
;
...
...
clippy_lints/src/ok_if_let.rs
浏览文件 @
98e433d7
use
crate
::
utils
::{
match_type
,
method_chain_args
,
paths
,
snippet
,
span_help_and_lint
};
use
if_chain
::
if_chain
;
use
rustc
::
declare_lint_pass
;
use
rustc
::
hir
::
*
;
use
rustc
::
lint
::{
LateContext
,
LateLintPass
,
LintArray
,
LintPass
};
use
rustc
::{
declare_lint_pass
,
declare_tool_lint
}
;
use
rustc
_session
::
declare_tool_lint
;
declare_clippy_lint!
{
/// **What it does:*** Checks for unnecessary `ok()` in if let.
...
...
clippy_lints/src/open_options.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/overflow_check_conditional.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/panic_unimplemented.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/partialeq_ne_impl.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/path_buf_push_overwrite.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/precedence.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/ptr.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/ptr_offset_with_cast.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/question_mark.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/ranges.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/redundant_clone.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/redundant_field_names.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/redundant_pattern_matching.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/redundant_static_lifetimes.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/reference.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/regex.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/replace_consts.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/returns.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/serde_api.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/shadow.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/slow_vector_initialization.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/strings.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/suspicious_trait_impl.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/swap.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/tabs_in_doc_comments.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/temporary_assignment.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/to_digit_is_some.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/trait_bounds.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/transmute.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/transmuting_null.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/trivially_copy_pass_by_ref.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/try_err.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/types.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unicode.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unsafe_removed_from_name.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unused_io_amount.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unused_label.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unused_self.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/unwrap.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/use_self.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/utils/author.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/utils/inspector.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/utils/internal_lints.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/utils/paths.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/vec.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/wildcard_dependencies.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/write.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
clippy_lints/src/zero_div_zero.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
doc/adding_lints.md
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
tests/ui/lint_without_lint_pass.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
tests/ui/lint_without_lint_pass.stderr
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
tests/ui/outer_expn_data.fixed
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
tests/ui/outer_expn_data.rs
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
tests/ui/outer_expn_data.stderr
浏览文件 @
98e433d7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录