Skip to content

Commit

Permalink
Auto merge of rust-lang#6128 - dtolnay:rc_buffer, r=yaahc
Browse files Browse the repository at this point in the history
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 [rust-lang#6044](rust-lang/rust-clippy#6044 (comment)) 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 rust-lang#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 rust-lang#6044, rust-lang#6090.
r? `@yaahc,` who reviewed the lint.

---

changelog: Remove rc_buffer from default set of enabled lints
  • Loading branch information
bors committed Oct 7, 2020
2 parents 2771918 + 0e159a5 commit 13a80b3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
]);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ declare_clippy_lint! {
/// fn foo(interned: Rc<str>) { ... }
/// ```
pub RC_BUFFER,
perf,
restriction,
"shared ownership of a buffer type"
}

Expand Down
2 changes: 1 addition & 1 deletion src/lintlist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 13a80b3

Please sign in to comment.