mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 19:04:21 +00:00
Add with_use_tree
This commit is contained in:
parent
fc4d0a7768
commit
381ace587e
@ -249,6 +249,16 @@ impl ast::PathSegment {
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::UseItem {
|
||||
#[must_use]
|
||||
pub fn with_use_tree(&self, use_tree: ast::UseTree) -> ast::UseItem {
|
||||
if let Some(old) = self.use_tree() {
|
||||
return replace_descendants(self, iter::once((old, use_tree)));
|
||||
}
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn strip_attrs_and_docs<N: ast::AttrsOwner>(node: &N) -> N {
|
||||
N::cast(strip_attrs_and_docs_inner(node.syntax().clone())).unwrap()
|
||||
|
Loading…
Reference in New Issue
Block a user