mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
clippy
This commit is contained in:
parent
6ce37fab95
commit
133e1d6773
@ -4,7 +4,7 @@ use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{Expr, ExprKind, StmtKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::{GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate};
|
||||
use rustc_middle::ty::{GenericPredicates, PredicateAtom, ProjectionPredicate, TraitPredicate};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::{BytePos, Span};
|
||||
|
||||
@ -42,8 +42,8 @@ fn get_trait_predicates_for_trait_id<'tcx>(
|
||||
let mut preds = Vec::new();
|
||||
for (pred, _) in generics.predicates {
|
||||
if_chain! {
|
||||
if let PredicateKind::Trait(poly_trait_pred, _) = pred.kind();
|
||||
let trait_pred = cx.tcx.erase_late_bound_regions(&poly_trait_pred);
|
||||
if let PredicateAtom::Trait(poly_trait_pred, _) = pred.skip_binders();
|
||||
let trait_pred = cx.tcx.erase_late_bound_regions(&ty::Binder::bind(poly_trait_pred));
|
||||
if let Some(trait_def_id) = trait_id;
|
||||
if trait_def_id == trait_pred.trait_ref.def_id;
|
||||
then {
|
||||
@ -60,8 +60,8 @@ fn get_projection_pred<'tcx>(
|
||||
pred: TraitPredicate<'tcx>,
|
||||
) -> Option<ProjectionPredicate<'tcx>> {
|
||||
generics.predicates.iter().find_map(|(proj_pred, _)| {
|
||||
if let PredicateKind::Projection(proj_pred) = proj_pred.kind() {
|
||||
let projection_pred = cx.tcx.erase_late_bound_regions(proj_pred);
|
||||
if let ty::PredicateAtom::Projection(proj_pred) = proj_pred.skip_binders() {
|
||||
let projection_pred = cx.tcx.erase_late_bound_regions(&ty::Binder::bind(proj_pred));
|
||||
if projection_pred.projection_ty.substs == pred.trait_ref.substs {
|
||||
return Some(projection_pred);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user