diff options
author | Aleksei Sidorov <[email protected]> | 2020-09-04 13:24:36 +0100 |
---|---|---|
committer | Aleksei Sidorov <[email protected]> | 2020-09-04 13:24:36 +0100 |
commit | 477fa75cfbdc923be366c75cb03b1e352f63c8e8 (patch) | |
tree | d8f6024891893f5c3ddf5f132b52a7a4ec3b6f4f /crates/syntax/src/ast | |
parent | 7259cc82f362bd1cd00f47ff3ffc71be769162b6 (diff) |
Fix nitpicks
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r-- | crates/syntax/src/ast/edit.rs | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 68987dbf6..5b5454c72 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs | |||
@@ -48,7 +48,7 @@ impl ast::Fn { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | #[must_use] | 50 | #[must_use] |
51 | pub fn with_generic_params(&self, generic_args: ast::GenericParamList) -> ast::Fn { | 51 | pub fn with_generic_param_list(&self, generic_args: ast::GenericParamList) -> ast::Fn { |
52 | if let Some(old) = self.generic_param_list() { | 52 | if let Some(old) = self.generic_param_list() { |
53 | return self.replace_descendant(old, generic_args); | 53 | return self.replace_descendant(old, generic_args); |
54 | } | 54 | } |
@@ -485,17 +485,7 @@ impl ast::GenericParamList { | |||
485 | 485 | ||
486 | #[must_use] | 486 | #[must_use] |
487 | pub fn append_param(&self, item: ast::GenericParam) -> ast::GenericParamList { | 487 | pub fn append_param(&self, item: ast::GenericParam) -> ast::GenericParamList { |
488 | let is_multiline = self.syntax().text().contains_char('\n'); | 488 | let space = tokens::single_space(); |
489 | let ws; | ||
490 | let space = if is_multiline { | ||
491 | ws = tokens::WsBuilder::new(&format!( | ||
492 | "\n{} ", | ||
493 | leading_indent(self.syntax()).unwrap_or_default() | ||
494 | )); | ||
495 | ws.ws() | ||
496 | } else { | ||
497 | tokens::single_space() | ||
498 | }; | ||
499 | 489 | ||
500 | let mut to_insert: ArrayVec<[SyntaxElement; 4]> = ArrayVec::new(); | 490 | let mut to_insert: ArrayVec<[SyntaxElement; 4]> = ArrayVec::new(); |
501 | if self.generic_params().next().is_some() { | 491 | if self.generic_params().next().is_some() { |
@@ -529,11 +519,6 @@ impl ast::GenericParamList { | |||
529 | }; | 519 | }; |
530 | }; | 520 | }; |
531 | 521 | ||
532 | if !is_multiline { | ||
533 | // don't insert comma before angle | ||
534 | to_insert.pop(); | ||
535 | } | ||
536 | |||
537 | let position = match self.generic_params().last() { | 522 | let position = match self.generic_params().last() { |
538 | Some(it) => after_field!(it), | 523 | Some(it) => after_field!(it), |
539 | None => after_l_angle!(), | 524 | None => after_l_angle!(), |