diff options
author | Timo Freiberg <[email protected]> | 2020-04-20 17:36:12 +0100 |
---|---|---|
committer | Timo Freiberg <[email protected]> | 2020-04-21 22:04:44 +0100 |
commit | f2f882bc44a85eb13276a8fbda7533d94e92e3af (patch) | |
tree | 14649a8ab0e85f8b8dbb62ef27a32706e1240df2 /crates/ra_syntax/src | |
parent | 74780a15f65916d08942eb53c43b8e8c0b62cb48 (diff) |
Add `pub(crate)` to functions generated in other module
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index b0f4803f3..ee0f5cc40 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -303,6 +303,10 @@ pub fn add_trailing_newlines(amount_of_newlines: usize, t: impl AstNode) -> ast: | |||
303 | ast_from_text(&format!("{}{}", t.syntax(), newlines)) | 303 | ast_from_text(&format!("{}{}", t.syntax(), newlines)) |
304 | } | 304 | } |
305 | 305 | ||
306 | pub fn add_pub_crate_modifier(fn_def: ast::FnDef) -> ast::FnDef { | ||
307 | ast_from_text(&format!("pub(crate) {}", fn_def)) | ||
308 | } | ||
309 | |||
306 | fn ast_from_text<N: AstNode>(text: &str) -> N { | 310 | fn ast_from_text<N: AstNode>(text: &str) -> N { |
307 | let parse = SourceFile::parse(text); | 311 | let parse = SourceFile::parse(text); |
308 | let node = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); | 312 | let node = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); |