Skip to content

Commit 13a80b3

Browse files
committed
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](#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 #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
2 parents 2771918 + 0e159a5 commit 13a80b3

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11721172
LintId::of(&shadow::SHADOW_REUSE),
11731173
LintId::of(&shadow::SHADOW_SAME),
11741174
LintId::of(&strings::STRING_ADD),
1175+
LintId::of(&types::RC_BUFFER),
11751176
LintId::of(&unwrap_in_result::UNWRAP_IN_RESULT),
11761177
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
11771178
LintId::of(&write::PRINT_STDOUT),
@@ -1505,7 +1506,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15051506
LintId::of(&types::CHAR_LIT_AS_U8),
15061507
LintId::of(&types::FN_TO_NUMERIC_CAST),
15071508
LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
1508-
LintId::of(&types::RC_BUFFER),
15091509
LintId::of(&types::REDUNDANT_ALLOCATION),
15101510
LintId::of(&types::TYPE_COMPLEXITY),
15111511
LintId::of(&types::UNIT_ARG),
@@ -1806,7 +1806,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
18061806
LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
18071807
LintId::of(&stable_sort_primitive::STABLE_SORT_PRIMITIVE),
18081808
LintId::of(&types::BOX_VEC),
1809-
LintId::of(&types::RC_BUFFER),
18101809
LintId::of(&types::REDUNDANT_ALLOCATION),
18111810
LintId::of(&vec::USELESS_VEC),
18121811
]);

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ declare_clippy_lint! {
242242
/// fn foo(interned: Rc<str>) { ... }
243243
/// ```
244244
pub RC_BUFFER,
245-
perf,
245+
restriction,
246246
"shared ownership of a buffer type"
247247
}
248248

src/lintlist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
18881888
},
18891889
Lint {
18901890
name: "rc_buffer",
1891-
group: "perf",
1891+
group: "restriction",
18921892
desc: "shared ownership of a buffer type",
18931893
deprecation: None,
18941894
module: "types",

0 commit comments

Comments
 (0)