Skip to content

Commit 27da6a1

Browse files
committed
Move needless_borrow to style
1 parent 9132e4d commit 27da6a1

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

clippy_lints/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16461646
LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
16471647
LintId::of(needless_bool::BOOL_COMPARISON),
16481648
LintId::of(needless_bool::NEEDLESS_BOOL),
1649+
LintId::of(needless_borrow::NEEDLESS_BORROW),
16491650
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
16501651
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
16511652
LintId::of(needless_update::NEEDLESS_UPDATE),
@@ -1829,6 +1830,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
18291830
LintId::of(misc_early::REDUNDANT_PATTERN),
18301831
LintId::of(mut_mutex_lock::MUT_MUTEX_LOCK),
18311832
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
1833+
LintId::of(needless_borrow::NEEDLESS_BORROW),
18321834
LintId::of(neg_multiply::NEG_MULTIPLY),
18331835
LintId::of(new_without_default::NEW_WITHOUT_DEFAULT),
18341836
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
@@ -2068,7 +2070,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
20682070
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
20692071
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
20702072
LintId::of(mutex_atomic::MUTEX_INTEGER),
2071-
LintId::of(needless_borrow::NEEDLESS_BORROW),
20722073
LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
20732074
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
20742075
LintId::of(regex::TRIVIAL_REGEX),

clippy_lints/src/needless_borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare_clippy_lint! {
3434
/// let x: &i32 = &5;
3535
/// ```
3636
pub NEEDLESS_BORROW,
37-
nursery,
37+
style,
3838
"taking a reference that is going to be automatically dereferenced"
3939
}
4040

clippy_lints/src/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ fn check_invalid_ptr_usage<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
211211
];
212212

213213
if_chain! {
214-
if let ExprKind::Call(ref fun, ref args) = expr.kind;
214+
if let ExprKind::Call(fun, args) = expr.kind;
215215
if let ExprKind::Path(ref qpath) = fun.kind;
216216
if let Some(fun_def_id) = cx.qpath_res(qpath, fun.hir_id).opt_def_id();
217217
let fun_def_path = cx.get_def_path(fun_def_id).into_iter().map(Symbol::to_ident_string).collect::<Vec<_>>();

clippy_lints/src/single_component_path_imports.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn check_mod(cx: &EarlyContext<'_>, items: &[P<Item>]) {
7070
for item in items {
7171
track_uses(
7272
cx,
73-
&item,
73+
item,
7474
&mut imports_reused_with_self,
7575
&mut single_use_usages,
7676
&mut macros,
@@ -117,7 +117,7 @@ fn track_uses(
117117

118118
match &item.kind {
119119
ItemKind::Mod(_, ModKind::Loaded(ref items, ..)) => {
120-
check_mod(cx, &items);
120+
check_mod(cx, items);
121121
},
122122
ItemKind::MacroDef(MacroDef { macro_rules: true, .. }) => {
123123
macros.push(item.ident.name);

clippy_lints/src/unused_io_amount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedIoAmount {
6666

6767
fn check_map_error(cx: &LateContext<'_>, call: &hir::Expr<'_>, expr: &hir::Expr<'_>) {
6868
let mut call = call;
69-
while let hir::ExprKind::MethodCall(ref path, _, ref args, _) = call.kind {
69+
while let hir::ExprKind::MethodCall(path, _, args, _) = call.kind {
7070
if matches!(&*path.ident.as_str(), "or" | "or_else" | "ok") {
7171
call = &args[0];
7272
} else {

clippy_lints/src/utils/internal_lints/metadata_collector.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl<'hir> LateLintPass<'hir> for MetadataCollector {
379379
/// }
380380
/// ```
381381
fn check_item(&mut self, cx: &LateContext<'hir>, item: &'hir Item<'_>) {
382-
if let ItemKind::Static(ref ty, Mutability::Not, _) = item.kind {
382+
if let ItemKind::Static(ty, Mutability::Not, _) = item.kind {
383383
// Normal lint
384384
if_chain! {
385385
// item validation
@@ -489,7 +489,7 @@ fn extract_attr_docs(cx: &LateContext<'_>, item: &Item<'_>) -> Option<String> {
489489
.hir()
490490
.attrs(item.hir_id())
491491
.iter()
492-
.filter_map(|ref x| x.doc_str().map(|sym| sym.as_str().to_string()))
492+
.filter_map(|x| x.doc_str().map(|sym| sym.as_str().to_string()))
493493
.reduce(|mut acc, sym| {
494494
acc.push_str(&sym);
495495
acc.push('\n');
@@ -596,7 +596,7 @@ fn extract_emission_info<'hir>(
596596
let mut multi_part = false;
597597

598598
for arg in args {
599-
let (arg_ty, _) = walk_ptrs_ty_depth(cx.typeck_results().expr_ty(&arg));
599+
let (arg_ty, _) = walk_ptrs_ty_depth(cx.typeck_results().expr_ty(arg));
600600

601601
if match_type(cx, arg_ty, &paths::LINT) {
602602
// If we found the lint arg, extract the lint name
@@ -671,7 +671,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for LintResolver<'a, 'hir> {
671671
if let ExprKind::Path(qpath) = &expr.kind;
672672
if let QPath::Resolved(_, path) = qpath;
673673

674-
let (expr_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(&expr));
674+
let (expr_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(expr));
675675
if match_type(self.cx, expr_ty, &paths::LINT);
676676
then {
677677
if let hir::def::Res::Def(DefKind::Static, _) = path.res {
@@ -730,7 +730,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for ApplicabilityResolver<'a, 'hir> {
730730
}
731731

732732
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
733-
let (expr_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(&expr));
733+
let (expr_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(expr));
734734

735735
if_chain! {
736736
if match_type(self.cx, expr_ty, &paths::APPLICABILITY);

0 commit comments

Comments
 (0)