diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2022-06-07 00:40:32 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2022-06-07 00:40:32 -0400 |
| commit | bf3ab592f04fafd854190f6960510bf0c23ef8ae (patch) | |
| tree | b878ac2ecc8072169172178a5d57705fba47d752 /clippy_utils/src | |
| parent | 72f5ff6903c6c914f6541422d004df3202916012 (diff) | |
| download | rust-bf3ab592f04fafd854190f6960510bf0c23ef8ae.tar.gz rust-bf3ab592f04fafd854190f6960510bf0c23ef8ae.zip | |
Changes to `iter_overeager_cloned`
* Don't lint on `.cloned().flatten()` when `T::Item` doesn't implement `IntoIterator` * Reduce verbosity of lint message * Narrow down the scope of the replacement range
Diffstat (limited to 'clippy_utils/src')
| -rw-r--r-- | clippy_utils/src/ty.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs index a10515d2fec..227e97d37ec 100644 --- a/clippy_utils/src/ty.rs +++ b/clippy_utils/src/ty.rs @@ -78,9 +78,9 @@ pub fn get_associated_type<'tcx>( cx.tcx .associated_items(trait_id) .find_by_name_and_kind(cx.tcx, Ident::from_str(name), ty::AssocKind::Type, trait_id) - .map(|assoc| { + .and_then(|assoc| { let proj = cx.tcx.mk_projection(assoc.def_id, cx.tcx.mk_substs_trait(ty, &[])); - cx.tcx.normalize_erasing_regions(cx.param_env, proj) + cx.tcx.try_normalize_erasing_regions(cx.param_env, proj).ok() }) } |
