aboutsummaryrefslogtreecommitdiff
path: root/lib/src/make.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-02 14:10:08 +0100
committerAkshay <[email protected]>2021-10-02 14:10:08 +0100
commit7a430237eea3e1d296e0d69e40f154a3727ba2fc (patch)
tree5a39f01ad5d7ea1931b0a884c613e8e4462c847f /lib/src/make.rs
parentc00900120d88c3d42666ed93716b821bd694e8d6 (diff)
new lint: manual_inherit_from
Diffstat (limited to 'lib/src/make.rs')
-rw-r--r--lib/src/make.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/src/make.rs b/lib/src/make.rs
index facd247..cf371a2 100644
--- a/lib/src/make.rs
+++ b/lib/src/make.rs
@@ -29,3 +29,12 @@ pub fn inherit_stmt<'a>(nodes: impl IntoIterator<Item = &'a types::Ident>) -> ty
29 .join(" "); 29 .join(" ");
30 ast_from_text(&format!("{{ inherit {}; }}", inherited_idents)) 30 ast_from_text(&format!("{{ inherit {}; }}", inherited_idents))
31} 31}
32
33pub fn inherit_from_stmt<'a>(from: SyntaxNode, nodes: impl IntoIterator<Item = &'a types::Ident>) -> types::Inherit {
34 let inherited_idents = nodes
35 .into_iter()
36 .map(|i| i.as_str().to_owned())
37 .collect::<Vec<_>>()
38 .join(" ");
39 ast_from_text(&format!("{{ inherit ({}) {}; }}", from, inherited_idents))
40}