Refactor QPath to take an ast::TraitRef
This commit is contained in:
parent
cf7df1e638
commit
b64c7b83dd
16 changed files with 119 additions and 187 deletions
|
@ -142,6 +142,10 @@ pub trait Folder {
|
|||
noop_fold_ty(t, self)
|
||||
}
|
||||
|
||||
fn fold_qpath(&mut self, t: P<QPath>) -> P<QPath> {
|
||||
noop_fold_qpath(t, self)
|
||||
}
|
||||
|
||||
fn fold_mod(&mut self, m: Mod) -> Mod {
|
||||
noop_fold_mod(m, self)
|
||||
}
|
||||
|
@ -435,12 +439,8 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
|
|||
fld.fold_opt_bounds(bounds),
|
||||
id)
|
||||
}
|
||||
TyQPath(ref qpath) => {
|
||||
TyQPath(P(QPath {
|
||||
for_type: fld.fold_ty(qpath.for_type.clone()),
|
||||
trait_name: fld.fold_path(qpath.trait_name.clone()),
|
||||
item_name: fld.fold_ident(qpath.item_name.clone()),
|
||||
}))
|
||||
TyQPath(qpath) => {
|
||||
TyQPath(fld.fold_qpath(qpath))
|
||||
}
|
||||
TyFixedLengthVec(ty, e) => {
|
||||
TyFixedLengthVec(fld.fold_ty(ty), fld.fold_expr(e))
|
||||
|
@ -456,6 +456,16 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn noop_fold_qpath<T: Folder>(qpath: P<QPath>, fld: &mut T) -> P<QPath> {
|
||||
qpath.map(|qpath| {
|
||||
QPath {
|
||||
self_type: fld.fold_ty(qpath.self_type),
|
||||
trait_ref: qpath.trait_ref.map(|tr| fld.fold_trait_ref(tr)),
|
||||
item_name: fld.fold_ident(qpath.item_name),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn noop_fold_foreign_mod<T: Folder>(ForeignMod {abi, view_items, items}: ForeignMod,
|
||||
fld: &mut T) -> ForeignMod {
|
||||
ForeignMod {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue