mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-22 09:01:23 +00:00
Simplify Pair to fully qualified
This commit is contained in:
parent
2d99b00fcc
commit
dee9fa3853
@ -32,19 +32,17 @@ impl Pair {
|
||||
}
|
||||
|
||||
pub fn to_fully_qualified(&self) -> String {
|
||||
format!("::{}", self.join("::"))
|
||||
let mut fully_qualified = String::new();
|
||||
for segment in self.iter_all_segments() {
|
||||
fully_qualified += "::";
|
||||
fully_qualified += &segment.to_string();
|
||||
}
|
||||
fully_qualified
|
||||
}
|
||||
|
||||
fn iter_all_segments(&self) -> impl Iterator<Item = &Ident> {
|
||||
self.namespace.iter().chain(iter::once(&self.cxx))
|
||||
}
|
||||
|
||||
fn join(&self, sep: &str) -> String {
|
||||
self.iter_all_segments()
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join(sep)
|
||||
}
|
||||
}
|
||||
|
||||
impl RustName {
|
||||
|
Loading…
x
Reference in New Issue
Block a user