mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +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
1 changed files with 10 additions and 0 deletions
|
@ -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 a new issue