Auto merge of #6128 - dtolnay:rc_buffer, r=yaahc

Downgrade rc_buffer to restriction

I think Arc\<Vec\<T\>\> and Arc\<String\> and similar are a totally reasonable data structure, as observed by others in the comments on [#6044](https://github.com/rust-lang/rust-clippy/pull/6044#event-3799579830) as well. Doing `Arc::make_mut(&mut self.vec).push(...)` or `Arc::make_mut(&mut self.string).push_str("...")` is a terrific and well performing copy-on-write pattern. Linting this with an enabled-by-default <kbd>performance</kbd> lint strikes me as an unacceptable false positive balance.

As of #6090 the documentation of this lint now contains:

> **Known problems:** This pattern can be desirable ...

which should indicate that we shouldn't be linting against correct, reasonable, well-performing patterns with an enabled-by-default lint.

Mentioning #6044, #6090.
r? `@yaahc,` who reviewed the lint.

---

changelog: Remove rc_buffer from default set of enabled lints
This commit is contained in:
bors 2020-10-07 23:10:34 +00:00
commit 13a80b34ba
3 changed files with 3 additions and 4 deletions

View File

@ -1172,6 +1172,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&shadow::SHADOW_REUSE),
LintId::of(&shadow::SHADOW_SAME),
LintId::of(&strings::STRING_ADD),
LintId::of(&types::RC_BUFFER),
LintId::of(&unwrap_in_result::UNWRAP_IN_RESULT),
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
LintId::of(&write::PRINT_STDOUT),
@ -1505,7 +1506,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&types::CHAR_LIT_AS_U8),
LintId::of(&types::FN_TO_NUMERIC_CAST),
LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
LintId::of(&types::RC_BUFFER),
LintId::of(&types::REDUNDANT_ALLOCATION),
LintId::of(&types::TYPE_COMPLEXITY),
LintId::of(&types::UNIT_ARG),
@ -1806,7 +1806,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
LintId::of(&stable_sort_primitive::STABLE_SORT_PRIMITIVE),
LintId::of(&types::BOX_VEC),
LintId::of(&types::RC_BUFFER),
LintId::of(&types::REDUNDANT_ALLOCATION),
LintId::of(&vec::USELESS_VEC),
]);

View File

@ -242,7 +242,7 @@ declare_clippy_lint! {
/// fn foo(interned: Rc<str>) { ... }
/// ```
pub RC_BUFFER,
perf,
restriction,
"shared ownership of a buffer type"
}

View File

@ -1888,7 +1888,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
},
Lint {
name: "rc_buffer",
group: "perf",
group: "restriction",
desc: "shared ownership of a buffer type",
deprecation: None,
module: "types",