mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Temporarily disable the needless_borrow lint
This commit is contained in:
parent
d247d9c690
commit
0692b2bb92
5 changed files with 15 additions and 6 deletions
|
@ -592,7 +592,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
mutex_atomic::MUTEX_ATOMIC,
|
mutex_atomic::MUTEX_ATOMIC,
|
||||||
needless_bool::BOOL_COMPARISON,
|
needless_bool::BOOL_COMPARISON,
|
||||||
needless_bool::NEEDLESS_BOOL,
|
needless_bool::NEEDLESS_BOOL,
|
||||||
needless_borrow::NEEDLESS_BORROW,
|
|
||||||
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
||||||
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
|
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
|
||||||
needless_update::NEEDLESS_UPDATE,
|
needless_update::NEEDLESS_UPDATE,
|
||||||
|
@ -771,7 +770,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
misc_early::ZERO_PREFIXED_LITERAL,
|
misc_early::ZERO_PREFIXED_LITERAL,
|
||||||
needless_bool::BOOL_COMPARISON,
|
needless_bool::BOOL_COMPARISON,
|
||||||
needless_bool::NEEDLESS_BOOL,
|
needless_bool::NEEDLESS_BOOL,
|
||||||
needless_borrow::NEEDLESS_BORROW,
|
|
||||||
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
||||||
needless_update::NEEDLESS_UPDATE,
|
needless_update::NEEDLESS_UPDATE,
|
||||||
no_effect::NO_EFFECT,
|
no_effect::NO_EFFECT,
|
||||||
|
@ -872,6 +870,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
|
attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
|
||||||
fallible_impl_from::FALLIBLE_IMPL_FROM,
|
fallible_impl_from::FALLIBLE_IMPL_FROM,
|
||||||
mutex_atomic::MUTEX_INTEGER,
|
mutex_atomic::MUTEX_INTEGER,
|
||||||
|
needless_borrow::NEEDLESS_BORROW,
|
||||||
ranges::RANGE_PLUS_ONE,
|
ranges::RANGE_PLUS_ONE,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ use utils::{in_macro, snippet_opt, span_lint_and_then};
|
||||||
/// ```
|
/// ```
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
pub NEEDLESS_BORROW,
|
pub NEEDLESS_BORROW,
|
||||||
complexity,
|
nursery,
|
||||||
"taking a reference that is going to be automatically dereferenced"
|
"taking a reference that is going to be automatically dereferenced"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
tests/run-pass/needless_borrow_fp.rs
Normal file
10
tests/run-pass/needless_borrow_fp.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#[deny(clippy)]
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Error {
|
||||||
|
Type(
|
||||||
|
&'static str,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
#![allow(unknown_lints, unused, no_effect, redundant_closure_call, many_single_char_names, needless_pass_by_value)]
|
#![allow(unknown_lints, unused, no_effect, redundant_closure_call, many_single_char_names, needless_pass_by_value)]
|
||||||
#![warn(redundant_closure)]
|
#![warn(redundant_closure, needless_borrow)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = Some(1u8).map(|a| foo(a));
|
let a = Some(1u8).map(|a| foo(a));
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn x(y: &i32) -> i32 {
|
||||||
*y
|
*y
|
||||||
}
|
}
|
||||||
|
|
||||||
#[warn(clippy)]
|
#[warn(clippy, needless_borrow)]
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = 5;
|
let a = 5;
|
||||||
|
@ -42,7 +42,7 @@ trait Trait {}
|
||||||
impl<'a> Trait for &'a str {}
|
impl<'a> Trait for &'a str {}
|
||||||
|
|
||||||
fn h(_: &Trait) {}
|
fn h(_: &Trait) {}
|
||||||
|
#[warn(needless_borrow)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn issue_1432() {
|
fn issue_1432() {
|
||||||
let mut v = Vec::<String>::new();
|
let mut v = Vec::<String>::new();
|
||||||
|
|
Loading…
Reference in a new issue