mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-15 10:07:30 +00:00
Merge #3480
3480: Add with_use_tree r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
6131cf32bc
@ -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