Skip to content

Commit e4be2b4

Browse files
committed
Downgrade needless_pass_by_value to allow by default
I noticed that I suppress this lint in many of my projects. https://github.com/search?q=needless_pass_by_value+user%3Adtolnay&type=Code https://github.com/search?q=needless_pass_by_value+user%3Aserde-rs&type=Code Upon further inspection, this lint has a *long* history of false positives (and several remaining). Generally I feel that this lint is the definition of pedantic and should not be linted by default. #[derive(Debug)] enum How { ThisWay, ThatWay, } // Are we really better off forcing the call sites to write f(&_)...? fn f(how: How) { println!("You want to do it {:?}", how); } fn main() { f(How::ThatWay); }
1 parent 64ff255 commit e4be2b4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clippy_lints/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
509509
misc_early::UNSEPARATED_LITERAL_SUFFIX,
510510
mut_mut::MUT_MUT,
511511
needless_continue::NEEDLESS_CONTINUE,
512+
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
512513
non_expressive_names::SIMILAR_NAMES,
513514
replace_consts::REPLACE_CONSTS,
514515
shadow::SHADOW_UNRELATED,
@@ -671,7 +672,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
671672
needless_bool::BOOL_COMPARISON,
672673
needless_bool::NEEDLESS_BOOL,
673674
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
674-
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
675675
needless_update::NEEDLESS_UPDATE,
676676
neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
677677
neg_multiply::NEG_MULTIPLY,
@@ -809,7 +809,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
809809
misc_early::MIXED_CASE_HEX_LITERALS,
810810
misc_early::UNNEEDED_FIELD_PATTERN,
811811
mut_reference::UNNECESSARY_MUT_PASSED,
812-
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
813812
neg_multiply::NEG_MULTIPLY,
814813
new_without_default::NEW_WITHOUT_DEFAULT,
815814
new_without_default::NEW_WITHOUT_DEFAULT_DERIVE,

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use crate::rustc_errors::Applicability;
5454
/// ```
5555
declare_clippy_lint! {
5656
pub NEEDLESS_PASS_BY_VALUE,
57-
style,
57+
pedantic,
5858
"functions taking arguments by value, but not consuming them in its body"
5959
}
6060

0 commit comments

Comments
 (0)