Skip to content

Commit f287b42

Browse files
committed
fix(multiple_inherent_impl): Criterion not needed in the value
1 parent fa88945 commit f287b42

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

book/src/lint_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ A list of paths to types that should be treated as if they do not contain interi
672672

673673

674674
## `inherent-impl-lint-scope`
675-
Sets the scope at which duplicate impl blocks for the same type are linted.
675+
Sets the scope ("crate", "file", or "module") in which duplicate inherent `impl` blocks for the same type are linted.
676676

677677
**Default Value:** `"crate"`
678678

clippy_config/src/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ define_Conf! {
663663
/// A list of paths to types that should be treated as if they do not contain interior mutability
664664
#[lints(borrow_interior_mutable_const, declare_interior_mutable_const, ifs_same_cond, mutable_key_type)]
665665
ignore_interior_mutability: Vec<String> = Vec::from(["bytes::Bytes".into()]),
666-
/// Sets the scope at which duplicate impl blocks for the same type are linted.
666+
/// Sets the scope ("crate", "file", or "module") in which duplicate inherent `impl` blocks for the same type are linted.
667667
#[lints(multiple_inherent_impl)]
668668
inherent_impl_lint_scope: InherentImplLintScope = InherentImplLintScope::Crate,
669669
/// The maximum size of the `Err`-variant in a `Result` returned from a function

clippy_lints/src/inherent_impl.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ declare_clippy_lint! {
1414
/// ### What it does
1515
/// Checks for multiple inherent implementations of a struct
1616
///
17-
/// The config option controls the scope at which multiple inherent impl blocks for the same
17+
/// The config option controls the scope in which multiple inherent `impl` blocks for the same
1818
/// struct are linted, allowing values of `module` (only within the same module), `file`
1919
/// (within the same file), or `crate` (anywhere in the crate, default).
2020
///
@@ -103,31 +103,31 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
103103
{
104104
Criterion::File(cx.tcx.sess.source_map().lookup_source_file(span.lo()).name.clone())
105105
} else {
106-
// We know we are working on an Impl, so the the pattern matching can
106+
// We know we are working on an impl, so the pattern matching can
107107
// not fail
108108
unreachable!()
109109
}
110110
},
111111
InherentImplLintScope::Crate => Criterion::Crate,
112112
};
113-
match type_map.entry((impl_ty, criterion.clone())) {
113+
match type_map.entry((impl_ty, criterion)) {
114114
Entry::Vacant(e) => {
115115
// Store the id for the first impl block of this type. The span is retrieved lazily.
116-
e.insert((IdOrSpan::Id(impl_id), criterion.clone()));
116+
e.insert(IdOrSpan::Id(impl_id));
117117
},
118118
Entry::Occupied(mut e) => {
119119
if let Some(span) = get_impl_span(cx, impl_id) {
120-
let first_span = match e.get().0 {
120+
let first_span = match *e.get() {
121121
IdOrSpan::Span(s) => s,
122122
IdOrSpan::Id(id) => {
123123
if let Some(s) = get_impl_span(cx, id) {
124124
// Remember the span of the first block.
125-
*e.get_mut() = (IdOrSpan::Span(s), criterion.clone());
125+
*e.get_mut() = IdOrSpan::Span(s);
126126
s
127127
} else {
128128
// The first impl block isn't considered by the lint. Replace it with the
129129
// current one.
130-
*e.get_mut() = (IdOrSpan::Span(span), criterion.clone());
130+
*e.get_mut() = IdOrSpan::Span(span);
131131
continue;
132132
}
133133
},

0 commit comments

Comments
 (0)