Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dangly paths #17

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Added impl fmt::Display for Path so path formats can resemble sourc…
…e code.
pnkfelix committed Sep 12, 2017
commit 0a7af36269b7e636415c79449d8202a447667225
15 changes: 15 additions & 0 deletions nll-repr/src/repr/mod.rs
Original file line number Diff line number Diff line change
@@ -306,6 +306,21 @@ impl Path {
}
}

impl fmt::Display for Path {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
match *self {
Path::Var(ref var) =>
write!(w, "{}", var.name),
Path::Extension(ref path, ref field_name) =>
if field_name.name == intern::intern("*") {
write!(w, "*{}", path)
} else {
write!(w, "{}.{}", path, field_name.name)
},
}
}
}

#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub enum Constraint {
ForAll(Vec<RegionName>, Box<Constraint>),