Make clippy and rustdoc happy
This commit is contained in:
parent
d4fa5648c3
commit
d325fb7c2e
2 changed files with 9 additions and 10 deletions
|
@ -56,19 +56,18 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
||||||
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
|
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let inherent_impls = cx
|
|
||||||
.tcx
|
|
||||||
.with_stable_hashing_context(|hcx| impls.inherent_impls.to_sorted(&hcx, true));
|
|
||||||
|
|
||||||
for (_, impl_ids) in inherent_impls.into_iter().filter(|(&id, impls)| {
|
for (&id, impl_ids) in &impls.inherent_impls {
|
||||||
impls.len() > 1
|
if impl_ids.len() < 2
|
||||||
// Check for `#[allow]` on the type definition
|
// Check for `#[allow]` on the type definition
|
||||||
&& !is_lint_allowed(
|
|| is_lint_allowed(
|
||||||
cx,
|
cx,
|
||||||
MULTIPLE_INHERENT_IMPL,
|
MULTIPLE_INHERENT_IMPL,
|
||||||
cx.tcx.local_def_id_to_hir_id(id),
|
cx.tcx.local_def_id_to_hir_id(id),
|
||||||
)
|
) {
|
||||||
}) {
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
|
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
|
||||||
let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity();
|
let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity();
|
||||||
match type_map.entry(impl_ty) {
|
match type_map.entry(impl_ty) {
|
||||||
|
|
|
@ -24,14 +24,14 @@ impl Foo<u32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Bar for Foo<T> {
|
impl<T> Bar for Foo<T> {
|
||||||
//@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' 'type Item = T'
|
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
|
||||||
type Item=T;
|
type Item=T;
|
||||||
|
|
||||||
//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
|
//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
|
||||||
fn quux(self) {}
|
fn quux(self) {}
|
||||||
}
|
}
|
||||||
impl<'a, T> Bar for &'a Foo<T> {
|
impl<'a, T> Bar for &'a Foo<T> {
|
||||||
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item = &'a T"
|
// @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T"
|
||||||
type Item=&'a T;
|
type Item=&'a T;
|
||||||
|
|
||||||
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
|
//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue