mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
Fix dogfood error.
This commit is contained in:
parent
2d1c9313b0
commit
2b2acf1002
2 changed files with 20 additions and 20 deletions
|
@ -210,7 +210,7 @@ impl<'a> DigitInfo<'a> {
|
||||||
.filter(|&c| c != '_')
|
.filter(|&c| c != '_')
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.chunks(group_size)
|
.chunks(group_size)
|
||||||
.map(|chunk| chunk.into_iter().rev().collect())
|
.map(|chunk| chunk.iter().rev().collect())
|
||||||
.rev()
|
.rev()
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("_");
|
.join("_");
|
||||||
|
@ -221,7 +221,7 @@ impl<'a> DigitInfo<'a> {
|
||||||
.filter(|&c| c != '_')
|
.filter(|&c| c != '_')
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.chunks(group_size)
|
.chunks(group_size)
|
||||||
.map(|chunk| chunk.into_iter().collect())
|
.map(|chunk| chunk.iter().collect())
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("_");
|
.join("_");
|
||||||
format!(
|
format!(
|
||||||
|
@ -238,7 +238,7 @@ impl<'a> DigitInfo<'a> {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let mut hint = filtered_digits_vec
|
let mut hint = filtered_digits_vec
|
||||||
.chunks(group_size)
|
.chunks(group_size)
|
||||||
.map(|chunk| chunk.into_iter().rev().collect())
|
.map(|chunk| chunk.iter().rev().collect())
|
||||||
.rev()
|
.rev()
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("_");
|
.join("_");
|
||||||
|
|
|
@ -2135,22 +2135,6 @@ fn lint_asref(cx: &LateContext<'_, '_>, expr: &hir::Expr, call_name: &str, as_re
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ty_has_iter_method(cx: &LateContext<'_, '_>, self_ref_ty: ty::Ty<'_>) -> Option<(&'static Lint, &'static str, &'static str)> {
|
fn ty_has_iter_method(cx: &LateContext<'_, '_>, self_ref_ty: ty::Ty<'_>) -> Option<(&'static Lint, &'static str, &'static str)> {
|
||||||
let (self_ty, mutbl) = match self_ref_ty.sty {
|
|
||||||
ty::TyKind::Ref(_, self_ty, mutbl) => (self_ty, mutbl),
|
|
||||||
_ => unreachable!(),
|
|
||||||
};
|
|
||||||
let method_name = match mutbl {
|
|
||||||
hir::MutImmutable => "iter",
|
|
||||||
hir::MutMutable => "iter_mut",
|
|
||||||
};
|
|
||||||
|
|
||||||
let def_id = match self_ty.sty {
|
|
||||||
ty::TyKind::Array(..) => return Some((INTO_ITER_ON_ARRAY, "array", method_name)),
|
|
||||||
ty::TyKind::Slice(..) => return Some((INTO_ITER_ON_REF, "slice", method_name)),
|
|
||||||
ty::Adt(adt, _) => adt.did,
|
|
||||||
_ => return None,
|
|
||||||
};
|
|
||||||
|
|
||||||
// FIXME: instead of this hard-coded list, we should check if `<adt>::iter`
|
// FIXME: instead of this hard-coded list, we should check if `<adt>::iter`
|
||||||
// exists and has the desired signature. Unfortunately FnCtxt is not exported
|
// exists and has the desired signature. Unfortunately FnCtxt is not exported
|
||||||
// so we can't use its `lookup_method` method.
|
// so we can't use its `lookup_method` method.
|
||||||
|
@ -2170,6 +2154,22 @@ fn ty_has_iter_method(cx: &LateContext<'_, '_>, self_ref_ty: ty::Ty<'_>) -> Opti
|
||||||
(INTO_ITER_ON_REF, &["std", "sync", "mpsc", "Receiver"]),
|
(INTO_ITER_ON_REF, &["std", "sync", "mpsc", "Receiver"]),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let (self_ty, mutbl) = match self_ref_ty.sty {
|
||||||
|
ty::TyKind::Ref(_, self_ty, mutbl) => (self_ty, mutbl),
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
let method_name = match mutbl {
|
||||||
|
hir::MutImmutable => "iter",
|
||||||
|
hir::MutMutable => "iter_mut",
|
||||||
|
};
|
||||||
|
|
||||||
|
let def_id = match self_ty.sty {
|
||||||
|
ty::TyKind::Array(..) => return Some((INTO_ITER_ON_ARRAY, "array", method_name)),
|
||||||
|
ty::TyKind::Slice(..) => return Some((INTO_ITER_ON_REF, "slice", method_name)),
|
||||||
|
ty::Adt(adt, _) => adt.did,
|
||||||
|
_ => return None,
|
||||||
|
};
|
||||||
|
|
||||||
for (lint, path) in &INTO_ITER_COLLECTIONS {
|
for (lint, path) in &INTO_ITER_COLLECTIONS {
|
||||||
if match_def_path(cx.tcx, def_id, path) {
|
if match_def_path(cx.tcx, def_id, path) {
|
||||||
return Some((lint, path.last().unwrap(), method_name))
|
return Some((lint, path.last().unwrap(), method_name))
|
||||||
|
|
Loading…
Reference in a new issue