From 7a430237eea3e1d296e0d69e40f154a3727ba2fc Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 2 Oct 2021 18:40:08 +0530 Subject: new lint: manual_inherit_from --- lib/src/make.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/src/make.rs') 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) -> ty .join(" "); ast_from_text(&format!("{{ inherit {}; }}", inherited_idents)) } + +pub fn inherit_from_stmt<'a>(from: SyntaxNode, nodes: impl IntoIterator) -> types::Inherit { + let inherited_idents = nodes + .into_iter() + .map(|i| i.as_str().to_owned()) + .collect::>() + .join(" "); + ast_from_text(&format!("{{ inherit ({}) {}; }}", from, inherited_idents)) +} -- cgit v1.2.3