libsyntax: Remove uses of advance.
This commit is contained in:
parent
bb9552ef00
commit
9e123c4056
2 changed files with 6 additions and 21 deletions
|
@ -87,24 +87,9 @@ static AbiDatas: &'static [AbiData] = &[
|
|||
AbiData {abi: RustIntrinsic, name: "rust-intrinsic", abi_arch: RustArch},
|
||||
];
|
||||
|
||||
/// Iterates through each of the defined ABIs.
|
||||
fn each_abi(op: |abi: Abi| -> bool) -> bool {
|
||||
AbiDatas.iter().advance(|abi_data| op(abi_data.abi))
|
||||
}
|
||||
|
||||
/// Returns the ABI with the given name (if any).
|
||||
pub fn lookup(name: &str) -> Option<Abi> {
|
||||
let mut res = None;
|
||||
|
||||
each_abi(|abi| {
|
||||
if name == abi.data().name {
|
||||
res = Some(abi);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
});
|
||||
res
|
||||
AbiDatas.iter().find(|abi_data| name == abi_data.name).map(|&x| x.abi)
|
||||
}
|
||||
|
||||
pub fn all_names() -> Vec<&'static str> {
|
||||
|
|
|
@ -611,18 +611,18 @@ pub fn walk_pat(pat: &Pat, it: |&Pat| -> bool) -> bool {
|
|||
match pat.node {
|
||||
PatIdent(_, _, Some(ref p)) => walk_pat(&**p, it),
|
||||
PatStruct(_, ref fields, _) => {
|
||||
fields.iter().advance(|f| walk_pat(&*f.pat, |p| it(p)))
|
||||
fields.iter().all(|field| walk_pat(&*field.pat, |p| it(p)))
|
||||
}
|
||||
PatEnum(_, Some(ref s)) | PatTup(ref s) => {
|
||||
s.iter().advance(|p| walk_pat(&**p, |p| it(p)))
|
||||
s.iter().all(|p| walk_pat(&**p, |p| it(p)))
|
||||
}
|
||||
PatBox(ref s) | PatRegion(ref s) => {
|
||||
walk_pat(&**s, it)
|
||||
}
|
||||
PatVec(ref before, ref slice, ref after) => {
|
||||
before.iter().advance(|p| walk_pat(&**p, |p| it(p))) &&
|
||||
slice.iter().advance(|p| walk_pat(&**p, |p| it(p))) &&
|
||||
after.iter().advance(|p| walk_pat(&**p, |p| it(p)))
|
||||
before.iter().all(|p| walk_pat(&**p, |p| it(p))) &&
|
||||
slice.iter().all(|p| walk_pat(&**p, |p| it(p))) &&
|
||||
after.iter().all(|p| walk_pat(&**p, |p| it(p)))
|
||||
}
|
||||
PatMac(_) => fail!("attempted to analyze unexpanded pattern"),
|
||||
PatWild | PatWildMulti | PatLit(_) | PatRange(_, _) | PatIdent(_, _, _) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue