diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 36 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 16 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 276 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/tokens.rs | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/tokens.rs | 69 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 13 |
8 files changed, 232 insertions, 195 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 29eb3fcb9..abc7a646c 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -189,6 +189,21 @@ impl ast::RecordFieldList { | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | impl ast::TypeAliasDef { | ||
193 | #[must_use] | ||
194 | pub fn remove_bounds(&self) -> ast::TypeAliasDef { | ||
195 | let colon = match self.colon_token() { | ||
196 | Some(it) => it, | ||
197 | None => return self.clone(), | ||
198 | }; | ||
199 | let end = match self.type_bound_list() { | ||
200 | Some(it) => it.syntax().clone().into(), | ||
201 | None => colon.clone().into(), | ||
202 | }; | ||
203 | self.replace_children(colon.into()..=end, iter::empty()) | ||
204 | } | ||
205 | } | ||
206 | |||
192 | impl ast::TypeParam { | 207 | impl ast::TypeParam { |
193 | #[must_use] | 208 | #[must_use] |
194 | pub fn remove_bounds(&self) -> ast::TypeParam { | 209 | pub fn remove_bounds(&self) -> ast::TypeParam { |
@@ -299,12 +314,8 @@ impl ast::UseTree { | |||
299 | Some(it) => it, | 314 | Some(it) => it, |
300 | None => return self.clone(), | 315 | None => return self.clone(), |
301 | }; | 316 | }; |
302 | let use_tree = make::use_tree( | 317 | let use_tree = |
303 | suffix.clone(), | 318 | make::use_tree(suffix, self.use_tree_list(), self.alias(), self.star_token().is_some()); |
304 | self.use_tree_list(), | ||
305 | self.alias(), | ||
306 | self.star_token().is_some(), | ||
307 | ); | ||
308 | let nested = make::use_tree_list(iter::once(use_tree)); | 319 | let nested = make::use_tree_list(iter::once(use_tree)); |
309 | return make::use_tree(prefix.clone(), Some(nested), None, false); | 320 | return make::use_tree(prefix.clone(), Some(nested), None, false); |
310 | 321 | ||
@@ -579,12 +590,17 @@ pub trait AstNodeEdit: AstNode + Clone + Sized { | |||
579 | rewriter.rewrite_ast(self) | 590 | rewriter.rewrite_ast(self) |
580 | } | 591 | } |
581 | #[must_use] | 592 | #[must_use] |
582 | fn indent(&self, indent: IndentLevel) -> Self { | 593 | fn indent(&self, level: IndentLevel) -> Self { |
583 | Self::cast(indent.increase_indent(self.syntax().clone())).unwrap() | 594 | Self::cast(level.increase_indent(self.syntax().clone())).unwrap() |
595 | } | ||
596 | #[must_use] | ||
597 | fn dedent(&self, level: IndentLevel) -> Self { | ||
598 | Self::cast(level.decrease_indent(self.syntax().clone())).unwrap() | ||
584 | } | 599 | } |
585 | #[must_use] | 600 | #[must_use] |
586 | fn dedent(&self, indent: IndentLevel) -> Self { | 601 | fn reset_indent(&self) -> Self { |
587 | Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap() | 602 | let level = IndentLevel::from_node(self.syntax()); |
603 | self.dedent(level) | ||
588 | } | 604 | } |
589 | } | 605 | } |
590 | 606 | ||
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 7771d6759..db5438d68 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -399,10 +399,7 @@ impl ast::BlockExpr { | |||
399 | Some(it) => it, | 399 | Some(it) => it, |
400 | None => return true, | 400 | None => return true, |
401 | }; | 401 | }; |
402 | match parent.kind() { | 402 | !matches!(parent.kind(), FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR) |
403 | FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR => false, | ||
404 | _ => true, | ||
405 | } | ||
406 | } | 403 | } |
407 | } | 404 | } |
408 | 405 | ||
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 98c38d009..662c6f73e 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -459,16 +459,16 @@ impl ast::RangePat { | |||
459 | 459 | ||
460 | impl ast::TokenTree { | 460 | impl ast::TokenTree { |
461 | pub fn left_delimiter_token(&self) -> Option<SyntaxToken> { | 461 | pub fn left_delimiter_token(&self) -> Option<SyntaxToken> { |
462 | self.syntax().first_child_or_token()?.into_token().filter(|it| match it.kind() { | 462 | self.syntax() |
463 | T!['{'] | T!['('] | T!['['] => true, | 463 | .first_child_or_token()? |
464 | _ => false, | 464 | .into_token() |
465 | }) | 465 | .filter(|it| matches!(it.kind(), T!['{'] | T!['('] | T!['['])) |
466 | } | 466 | } |
467 | 467 | ||
468 | pub fn right_delimiter_token(&self) -> Option<SyntaxToken> { | 468 | pub fn right_delimiter_token(&self) -> Option<SyntaxToken> { |
469 | self.syntax().last_child_or_token()?.into_token().filter(|it| match it.kind() { | 469 | self.syntax() |
470 | T!['}'] | T![')'] | T![']'] => true, | 470 | .last_child_or_token()? |
471 | _ => false, | 471 | .into_token() |
472 | }) | 472 | .filter(|it| matches!(it.kind(), T!['}'] | T![')'] | T![']'])) |
473 | } | 473 | } |
474 | } | 474 | } |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index cb430ca01..58141da11 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -2052,6 +2052,8 @@ pub struct WherePred { | |||
2052 | } | 2052 | } |
2053 | impl ast::TypeBoundsOwner for WherePred {} | 2053 | impl ast::TypeBoundsOwner for WherePred {} |
2054 | impl WherePred { | 2054 | impl WherePred { |
2055 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
2056 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | ||
2055 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 2057 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2056 | support::token(&self.syntax, T![lifetime]) | 2058 | support::token(&self.syntax, T![lifetime]) |
2057 | } | 2059 | } |
@@ -4849,687 +4851,687 @@ impl AstNode for FieldDefList { | |||
4849 | } | 4851 | } |
4850 | } | 4852 | } |
4851 | impl std::fmt::Display for NominalDef { | 4853 | impl std::fmt::Display for NominalDef { |
4852 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4854 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4853 | std::fmt::Display::fmt(self.syntax(), f) | 4855 | std::fmt::Display::fmt(self.syntax(), f) |
4854 | } | 4856 | } |
4855 | } | 4857 | } |
4856 | impl std::fmt::Display for GenericParam { | 4858 | impl std::fmt::Display for GenericParam { |
4857 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4859 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4858 | std::fmt::Display::fmt(self.syntax(), f) | 4860 | std::fmt::Display::fmt(self.syntax(), f) |
4859 | } | 4861 | } |
4860 | } | 4862 | } |
4861 | impl std::fmt::Display for GenericArg { | 4863 | impl std::fmt::Display for GenericArg { |
4862 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4864 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4863 | std::fmt::Display::fmt(self.syntax(), f) | 4865 | std::fmt::Display::fmt(self.syntax(), f) |
4864 | } | 4866 | } |
4865 | } | 4867 | } |
4866 | impl std::fmt::Display for TypeRef { | 4868 | impl std::fmt::Display for TypeRef { |
4867 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4869 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4868 | std::fmt::Display::fmt(self.syntax(), f) | 4870 | std::fmt::Display::fmt(self.syntax(), f) |
4869 | } | 4871 | } |
4870 | } | 4872 | } |
4871 | impl std::fmt::Display for ModuleItem { | 4873 | impl std::fmt::Display for ModuleItem { |
4872 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4874 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4873 | std::fmt::Display::fmt(self.syntax(), f) | 4875 | std::fmt::Display::fmt(self.syntax(), f) |
4874 | } | 4876 | } |
4875 | } | 4877 | } |
4876 | impl std::fmt::Display for AssocItem { | 4878 | impl std::fmt::Display for AssocItem { |
4877 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4879 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4878 | std::fmt::Display::fmt(self.syntax(), f) | 4880 | std::fmt::Display::fmt(self.syntax(), f) |
4879 | } | 4881 | } |
4880 | } | 4882 | } |
4881 | impl std::fmt::Display for ExternItem { | 4883 | impl std::fmt::Display for ExternItem { |
4882 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4884 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4883 | std::fmt::Display::fmt(self.syntax(), f) | 4885 | std::fmt::Display::fmt(self.syntax(), f) |
4884 | } | 4886 | } |
4885 | } | 4887 | } |
4886 | impl std::fmt::Display for Expr { | 4888 | impl std::fmt::Display for Expr { |
4887 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4889 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4888 | std::fmt::Display::fmt(self.syntax(), f) | 4890 | std::fmt::Display::fmt(self.syntax(), f) |
4889 | } | 4891 | } |
4890 | } | 4892 | } |
4891 | impl std::fmt::Display for Pat { | 4893 | impl std::fmt::Display for Pat { |
4892 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4894 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4893 | std::fmt::Display::fmt(self.syntax(), f) | 4895 | std::fmt::Display::fmt(self.syntax(), f) |
4894 | } | 4896 | } |
4895 | } | 4897 | } |
4896 | impl std::fmt::Display for RecordInnerPat { | 4898 | impl std::fmt::Display for RecordInnerPat { |
4897 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4899 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4898 | std::fmt::Display::fmt(self.syntax(), f) | 4900 | std::fmt::Display::fmt(self.syntax(), f) |
4899 | } | 4901 | } |
4900 | } | 4902 | } |
4901 | impl std::fmt::Display for AttrInput { | 4903 | impl std::fmt::Display for AttrInput { |
4902 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4904 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4903 | std::fmt::Display::fmt(self.syntax(), f) | 4905 | std::fmt::Display::fmt(self.syntax(), f) |
4904 | } | 4906 | } |
4905 | } | 4907 | } |
4906 | impl std::fmt::Display for Stmt { | 4908 | impl std::fmt::Display for Stmt { |
4907 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4909 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4908 | std::fmt::Display::fmt(self.syntax(), f) | 4910 | std::fmt::Display::fmt(self.syntax(), f) |
4909 | } | 4911 | } |
4910 | } | 4912 | } |
4911 | impl std::fmt::Display for FieldDefList { | 4913 | impl std::fmt::Display for FieldDefList { |
4912 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4914 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4913 | std::fmt::Display::fmt(self.syntax(), f) | 4915 | std::fmt::Display::fmt(self.syntax(), f) |
4914 | } | 4916 | } |
4915 | } | 4917 | } |
4916 | impl std::fmt::Display for SourceFile { | 4918 | impl std::fmt::Display for SourceFile { |
4917 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4919 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4918 | std::fmt::Display::fmt(self.syntax(), f) | 4920 | std::fmt::Display::fmt(self.syntax(), f) |
4919 | } | 4921 | } |
4920 | } | 4922 | } |
4921 | impl std::fmt::Display for FnDef { | 4923 | impl std::fmt::Display for FnDef { |
4922 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4924 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4923 | std::fmt::Display::fmt(self.syntax(), f) | 4925 | std::fmt::Display::fmt(self.syntax(), f) |
4924 | } | 4926 | } |
4925 | } | 4927 | } |
4926 | impl std::fmt::Display for RetType { | 4928 | impl std::fmt::Display for RetType { |
4927 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4929 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4928 | std::fmt::Display::fmt(self.syntax(), f) | 4930 | std::fmt::Display::fmt(self.syntax(), f) |
4929 | } | 4931 | } |
4930 | } | 4932 | } |
4931 | impl std::fmt::Display for StructDef { | 4933 | impl std::fmt::Display for StructDef { |
4932 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4934 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4933 | std::fmt::Display::fmt(self.syntax(), f) | 4935 | std::fmt::Display::fmt(self.syntax(), f) |
4934 | } | 4936 | } |
4935 | } | 4937 | } |
4936 | impl std::fmt::Display for UnionDef { | 4938 | impl std::fmt::Display for UnionDef { |
4937 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4939 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4938 | std::fmt::Display::fmt(self.syntax(), f) | 4940 | std::fmt::Display::fmt(self.syntax(), f) |
4939 | } | 4941 | } |
4940 | } | 4942 | } |
4941 | impl std::fmt::Display for RecordFieldDefList { | 4943 | impl std::fmt::Display for RecordFieldDefList { |
4942 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4944 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4943 | std::fmt::Display::fmt(self.syntax(), f) | 4945 | std::fmt::Display::fmt(self.syntax(), f) |
4944 | } | 4946 | } |
4945 | } | 4947 | } |
4946 | impl std::fmt::Display for RecordFieldDef { | 4948 | impl std::fmt::Display for RecordFieldDef { |
4947 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4949 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4948 | std::fmt::Display::fmt(self.syntax(), f) | 4950 | std::fmt::Display::fmt(self.syntax(), f) |
4949 | } | 4951 | } |
4950 | } | 4952 | } |
4951 | impl std::fmt::Display for TupleFieldDefList { | 4953 | impl std::fmt::Display for TupleFieldDefList { |
4952 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4954 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4953 | std::fmt::Display::fmt(self.syntax(), f) | 4955 | std::fmt::Display::fmt(self.syntax(), f) |
4954 | } | 4956 | } |
4955 | } | 4957 | } |
4956 | impl std::fmt::Display for TupleFieldDef { | 4958 | impl std::fmt::Display for TupleFieldDef { |
4957 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4959 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4958 | std::fmt::Display::fmt(self.syntax(), f) | 4960 | std::fmt::Display::fmt(self.syntax(), f) |
4959 | } | 4961 | } |
4960 | } | 4962 | } |
4961 | impl std::fmt::Display for EnumDef { | 4963 | impl std::fmt::Display for EnumDef { |
4962 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4964 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4963 | std::fmt::Display::fmt(self.syntax(), f) | 4965 | std::fmt::Display::fmt(self.syntax(), f) |
4964 | } | 4966 | } |
4965 | } | 4967 | } |
4966 | impl std::fmt::Display for EnumVariantList { | 4968 | impl std::fmt::Display for EnumVariantList { |
4967 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4969 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4968 | std::fmt::Display::fmt(self.syntax(), f) | 4970 | std::fmt::Display::fmt(self.syntax(), f) |
4969 | } | 4971 | } |
4970 | } | 4972 | } |
4971 | impl std::fmt::Display for EnumVariant { | 4973 | impl std::fmt::Display for EnumVariant { |
4972 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4974 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4973 | std::fmt::Display::fmt(self.syntax(), f) | 4975 | std::fmt::Display::fmt(self.syntax(), f) |
4974 | } | 4976 | } |
4975 | } | 4977 | } |
4976 | impl std::fmt::Display for TraitDef { | 4978 | impl std::fmt::Display for TraitDef { |
4977 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4979 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4978 | std::fmt::Display::fmt(self.syntax(), f) | 4980 | std::fmt::Display::fmt(self.syntax(), f) |
4979 | } | 4981 | } |
4980 | } | 4982 | } |
4981 | impl std::fmt::Display for Module { | 4983 | impl std::fmt::Display for Module { |
4982 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4984 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4983 | std::fmt::Display::fmt(self.syntax(), f) | 4985 | std::fmt::Display::fmt(self.syntax(), f) |
4984 | } | 4986 | } |
4985 | } | 4987 | } |
4986 | impl std::fmt::Display for ItemList { | 4988 | impl std::fmt::Display for ItemList { |
4987 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4989 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4988 | std::fmt::Display::fmt(self.syntax(), f) | 4990 | std::fmt::Display::fmt(self.syntax(), f) |
4989 | } | 4991 | } |
4990 | } | 4992 | } |
4991 | impl std::fmt::Display for ConstDef { | 4993 | impl std::fmt::Display for ConstDef { |
4992 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4994 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4993 | std::fmt::Display::fmt(self.syntax(), f) | 4995 | std::fmt::Display::fmt(self.syntax(), f) |
4994 | } | 4996 | } |
4995 | } | 4997 | } |
4996 | impl std::fmt::Display for StaticDef { | 4998 | impl std::fmt::Display for StaticDef { |
4997 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4999 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4998 | std::fmt::Display::fmt(self.syntax(), f) | 5000 | std::fmt::Display::fmt(self.syntax(), f) |
4999 | } | 5001 | } |
5000 | } | 5002 | } |
5001 | impl std::fmt::Display for TypeAliasDef { | 5003 | impl std::fmt::Display for TypeAliasDef { |
5002 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5004 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5003 | std::fmt::Display::fmt(self.syntax(), f) | 5005 | std::fmt::Display::fmt(self.syntax(), f) |
5004 | } | 5006 | } |
5005 | } | 5007 | } |
5006 | impl std::fmt::Display for ImplDef { | 5008 | impl std::fmt::Display for ImplDef { |
5007 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5009 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5008 | std::fmt::Display::fmt(self.syntax(), f) | 5010 | std::fmt::Display::fmt(self.syntax(), f) |
5009 | } | 5011 | } |
5010 | } | 5012 | } |
5011 | impl std::fmt::Display for ParenType { | 5013 | impl std::fmt::Display for ParenType { |
5012 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5014 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5013 | std::fmt::Display::fmt(self.syntax(), f) | 5015 | std::fmt::Display::fmt(self.syntax(), f) |
5014 | } | 5016 | } |
5015 | } | 5017 | } |
5016 | impl std::fmt::Display for TupleType { | 5018 | impl std::fmt::Display for TupleType { |
5017 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5019 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5018 | std::fmt::Display::fmt(self.syntax(), f) | 5020 | std::fmt::Display::fmt(self.syntax(), f) |
5019 | } | 5021 | } |
5020 | } | 5022 | } |
5021 | impl std::fmt::Display for NeverType { | 5023 | impl std::fmt::Display for NeverType { |
5022 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5024 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5023 | std::fmt::Display::fmt(self.syntax(), f) | 5025 | std::fmt::Display::fmt(self.syntax(), f) |
5024 | } | 5026 | } |
5025 | } | 5027 | } |
5026 | impl std::fmt::Display for PathType { | 5028 | impl std::fmt::Display for PathType { |
5027 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5029 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5028 | std::fmt::Display::fmt(self.syntax(), f) | 5030 | std::fmt::Display::fmt(self.syntax(), f) |
5029 | } | 5031 | } |
5030 | } | 5032 | } |
5031 | impl std::fmt::Display for PointerType { | 5033 | impl std::fmt::Display for PointerType { |
5032 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5034 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5033 | std::fmt::Display::fmt(self.syntax(), f) | 5035 | std::fmt::Display::fmt(self.syntax(), f) |
5034 | } | 5036 | } |
5035 | } | 5037 | } |
5036 | impl std::fmt::Display for ArrayType { | 5038 | impl std::fmt::Display for ArrayType { |
5037 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5039 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5038 | std::fmt::Display::fmt(self.syntax(), f) | 5040 | std::fmt::Display::fmt(self.syntax(), f) |
5039 | } | 5041 | } |
5040 | } | 5042 | } |
5041 | impl std::fmt::Display for SliceType { | 5043 | impl std::fmt::Display for SliceType { |
5042 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5044 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5043 | std::fmt::Display::fmt(self.syntax(), f) | 5045 | std::fmt::Display::fmt(self.syntax(), f) |
5044 | } | 5046 | } |
5045 | } | 5047 | } |
5046 | impl std::fmt::Display for ReferenceType { | 5048 | impl std::fmt::Display for ReferenceType { |
5047 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5049 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5048 | std::fmt::Display::fmt(self.syntax(), f) | 5050 | std::fmt::Display::fmt(self.syntax(), f) |
5049 | } | 5051 | } |
5050 | } | 5052 | } |
5051 | impl std::fmt::Display for PlaceholderType { | 5053 | impl std::fmt::Display for PlaceholderType { |
5052 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5054 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5053 | std::fmt::Display::fmt(self.syntax(), f) | 5055 | std::fmt::Display::fmt(self.syntax(), f) |
5054 | } | 5056 | } |
5055 | } | 5057 | } |
5056 | impl std::fmt::Display for FnPointerType { | 5058 | impl std::fmt::Display for FnPointerType { |
5057 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5059 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5058 | std::fmt::Display::fmt(self.syntax(), f) | 5060 | std::fmt::Display::fmt(self.syntax(), f) |
5059 | } | 5061 | } |
5060 | } | 5062 | } |
5061 | impl std::fmt::Display for ForType { | 5063 | impl std::fmt::Display for ForType { |
5062 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5064 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5063 | std::fmt::Display::fmt(self.syntax(), f) | 5065 | std::fmt::Display::fmt(self.syntax(), f) |
5064 | } | 5066 | } |
5065 | } | 5067 | } |
5066 | impl std::fmt::Display for ImplTraitType { | 5068 | impl std::fmt::Display for ImplTraitType { |
5067 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5069 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5068 | std::fmt::Display::fmt(self.syntax(), f) | 5070 | std::fmt::Display::fmt(self.syntax(), f) |
5069 | } | 5071 | } |
5070 | } | 5072 | } |
5071 | impl std::fmt::Display for DynTraitType { | 5073 | impl std::fmt::Display for DynTraitType { |
5072 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5074 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5073 | std::fmt::Display::fmt(self.syntax(), f) | 5075 | std::fmt::Display::fmt(self.syntax(), f) |
5074 | } | 5076 | } |
5075 | } | 5077 | } |
5076 | impl std::fmt::Display for TupleExpr { | 5078 | impl std::fmt::Display for TupleExpr { |
5077 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5079 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5078 | std::fmt::Display::fmt(self.syntax(), f) | 5080 | std::fmt::Display::fmt(self.syntax(), f) |
5079 | } | 5081 | } |
5080 | } | 5082 | } |
5081 | impl std::fmt::Display for ArrayExpr { | 5083 | impl std::fmt::Display for ArrayExpr { |
5082 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5084 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5083 | std::fmt::Display::fmt(self.syntax(), f) | 5085 | std::fmt::Display::fmt(self.syntax(), f) |
5084 | } | 5086 | } |
5085 | } | 5087 | } |
5086 | impl std::fmt::Display for ParenExpr { | 5088 | impl std::fmt::Display for ParenExpr { |
5087 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5089 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5088 | std::fmt::Display::fmt(self.syntax(), f) | 5090 | std::fmt::Display::fmt(self.syntax(), f) |
5089 | } | 5091 | } |
5090 | } | 5092 | } |
5091 | impl std::fmt::Display for PathExpr { | 5093 | impl std::fmt::Display for PathExpr { |
5092 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5094 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5093 | std::fmt::Display::fmt(self.syntax(), f) | 5095 | std::fmt::Display::fmt(self.syntax(), f) |
5094 | } | 5096 | } |
5095 | } | 5097 | } |
5096 | impl std::fmt::Display for LambdaExpr { | 5098 | impl std::fmt::Display for LambdaExpr { |
5097 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5099 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5098 | std::fmt::Display::fmt(self.syntax(), f) | 5100 | std::fmt::Display::fmt(self.syntax(), f) |
5099 | } | 5101 | } |
5100 | } | 5102 | } |
5101 | impl std::fmt::Display for IfExpr { | 5103 | impl std::fmt::Display for IfExpr { |
5102 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5104 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5103 | std::fmt::Display::fmt(self.syntax(), f) | 5105 | std::fmt::Display::fmt(self.syntax(), f) |
5104 | } | 5106 | } |
5105 | } | 5107 | } |
5106 | impl std::fmt::Display for LoopExpr { | 5108 | impl std::fmt::Display for LoopExpr { |
5107 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5109 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5108 | std::fmt::Display::fmt(self.syntax(), f) | 5110 | std::fmt::Display::fmt(self.syntax(), f) |
5109 | } | 5111 | } |
5110 | } | 5112 | } |
5111 | impl std::fmt::Display for EffectExpr { | 5113 | impl std::fmt::Display for EffectExpr { |
5112 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5114 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5113 | std::fmt::Display::fmt(self.syntax(), f) | 5115 | std::fmt::Display::fmt(self.syntax(), f) |
5114 | } | 5116 | } |
5115 | } | 5117 | } |
5116 | impl std::fmt::Display for ForExpr { | 5118 | impl std::fmt::Display for ForExpr { |
5117 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5119 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5118 | std::fmt::Display::fmt(self.syntax(), f) | 5120 | std::fmt::Display::fmt(self.syntax(), f) |
5119 | } | 5121 | } |
5120 | } | 5122 | } |
5121 | impl std::fmt::Display for WhileExpr { | 5123 | impl std::fmt::Display for WhileExpr { |
5122 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5124 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5123 | std::fmt::Display::fmt(self.syntax(), f) | 5125 | std::fmt::Display::fmt(self.syntax(), f) |
5124 | } | 5126 | } |
5125 | } | 5127 | } |
5126 | impl std::fmt::Display for ContinueExpr { | 5128 | impl std::fmt::Display for ContinueExpr { |
5127 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5129 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5128 | std::fmt::Display::fmt(self.syntax(), f) | 5130 | std::fmt::Display::fmt(self.syntax(), f) |
5129 | } | 5131 | } |
5130 | } | 5132 | } |
5131 | impl std::fmt::Display for BreakExpr { | 5133 | impl std::fmt::Display for BreakExpr { |
5132 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5134 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5133 | std::fmt::Display::fmt(self.syntax(), f) | 5135 | std::fmt::Display::fmt(self.syntax(), f) |
5134 | } | 5136 | } |
5135 | } | 5137 | } |
5136 | impl std::fmt::Display for Label { | 5138 | impl std::fmt::Display for Label { |
5137 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5139 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5138 | std::fmt::Display::fmt(self.syntax(), f) | 5140 | std::fmt::Display::fmt(self.syntax(), f) |
5139 | } | 5141 | } |
5140 | } | 5142 | } |
5141 | impl std::fmt::Display for BlockExpr { | 5143 | impl std::fmt::Display for BlockExpr { |
5142 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5144 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5143 | std::fmt::Display::fmt(self.syntax(), f) | 5145 | std::fmt::Display::fmt(self.syntax(), f) |
5144 | } | 5146 | } |
5145 | } | 5147 | } |
5146 | impl std::fmt::Display for ReturnExpr { | 5148 | impl std::fmt::Display for ReturnExpr { |
5147 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5149 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5148 | std::fmt::Display::fmt(self.syntax(), f) | 5150 | std::fmt::Display::fmt(self.syntax(), f) |
5149 | } | 5151 | } |
5150 | } | 5152 | } |
5151 | impl std::fmt::Display for CallExpr { | 5153 | impl std::fmt::Display for CallExpr { |
5152 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5154 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5153 | std::fmt::Display::fmt(self.syntax(), f) | 5155 | std::fmt::Display::fmt(self.syntax(), f) |
5154 | } | 5156 | } |
5155 | } | 5157 | } |
5156 | impl std::fmt::Display for MethodCallExpr { | 5158 | impl std::fmt::Display for MethodCallExpr { |
5157 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5159 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5158 | std::fmt::Display::fmt(self.syntax(), f) | 5160 | std::fmt::Display::fmt(self.syntax(), f) |
5159 | } | 5161 | } |
5160 | } | 5162 | } |
5161 | impl std::fmt::Display for IndexExpr { | 5163 | impl std::fmt::Display for IndexExpr { |
5162 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5164 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5163 | std::fmt::Display::fmt(self.syntax(), f) | 5165 | std::fmt::Display::fmt(self.syntax(), f) |
5164 | } | 5166 | } |
5165 | } | 5167 | } |
5166 | impl std::fmt::Display for FieldExpr { | 5168 | impl std::fmt::Display for FieldExpr { |
5167 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5169 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5168 | std::fmt::Display::fmt(self.syntax(), f) | 5170 | std::fmt::Display::fmt(self.syntax(), f) |
5169 | } | 5171 | } |
5170 | } | 5172 | } |
5171 | impl std::fmt::Display for AwaitExpr { | 5173 | impl std::fmt::Display for AwaitExpr { |
5172 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5174 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5173 | std::fmt::Display::fmt(self.syntax(), f) | 5175 | std::fmt::Display::fmt(self.syntax(), f) |
5174 | } | 5176 | } |
5175 | } | 5177 | } |
5176 | impl std::fmt::Display for TryExpr { | 5178 | impl std::fmt::Display for TryExpr { |
5177 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5179 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5178 | std::fmt::Display::fmt(self.syntax(), f) | 5180 | std::fmt::Display::fmt(self.syntax(), f) |
5179 | } | 5181 | } |
5180 | } | 5182 | } |
5181 | impl std::fmt::Display for CastExpr { | 5183 | impl std::fmt::Display for CastExpr { |
5182 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5184 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5183 | std::fmt::Display::fmt(self.syntax(), f) | 5185 | std::fmt::Display::fmt(self.syntax(), f) |
5184 | } | 5186 | } |
5185 | } | 5187 | } |
5186 | impl std::fmt::Display for RefExpr { | 5188 | impl std::fmt::Display for RefExpr { |
5187 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5189 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5188 | std::fmt::Display::fmt(self.syntax(), f) | 5190 | std::fmt::Display::fmt(self.syntax(), f) |
5189 | } | 5191 | } |
5190 | } | 5192 | } |
5191 | impl std::fmt::Display for PrefixExpr { | 5193 | impl std::fmt::Display for PrefixExpr { |
5192 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5194 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5193 | std::fmt::Display::fmt(self.syntax(), f) | 5195 | std::fmt::Display::fmt(self.syntax(), f) |
5194 | } | 5196 | } |
5195 | } | 5197 | } |
5196 | impl std::fmt::Display for BoxExpr { | 5198 | impl std::fmt::Display for BoxExpr { |
5197 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5199 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5198 | std::fmt::Display::fmt(self.syntax(), f) | 5200 | std::fmt::Display::fmt(self.syntax(), f) |
5199 | } | 5201 | } |
5200 | } | 5202 | } |
5201 | impl std::fmt::Display for RangeExpr { | 5203 | impl std::fmt::Display for RangeExpr { |
5202 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5204 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5203 | std::fmt::Display::fmt(self.syntax(), f) | 5205 | std::fmt::Display::fmt(self.syntax(), f) |
5204 | } | 5206 | } |
5205 | } | 5207 | } |
5206 | impl std::fmt::Display for BinExpr { | 5208 | impl std::fmt::Display for BinExpr { |
5207 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5209 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5208 | std::fmt::Display::fmt(self.syntax(), f) | 5210 | std::fmt::Display::fmt(self.syntax(), f) |
5209 | } | 5211 | } |
5210 | } | 5212 | } |
5211 | impl std::fmt::Display for Literal { | 5213 | impl std::fmt::Display for Literal { |
5212 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5214 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5213 | std::fmt::Display::fmt(self.syntax(), f) | 5215 | std::fmt::Display::fmt(self.syntax(), f) |
5214 | } | 5216 | } |
5215 | } | 5217 | } |
5216 | impl std::fmt::Display for MatchExpr { | 5218 | impl std::fmt::Display for MatchExpr { |
5217 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5219 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5218 | std::fmt::Display::fmt(self.syntax(), f) | 5220 | std::fmt::Display::fmt(self.syntax(), f) |
5219 | } | 5221 | } |
5220 | } | 5222 | } |
5221 | impl std::fmt::Display for MatchArmList { | 5223 | impl std::fmt::Display for MatchArmList { |
5222 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5224 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5223 | std::fmt::Display::fmt(self.syntax(), f) | 5225 | std::fmt::Display::fmt(self.syntax(), f) |
5224 | } | 5226 | } |
5225 | } | 5227 | } |
5226 | impl std::fmt::Display for MatchArm { | 5228 | impl std::fmt::Display for MatchArm { |
5227 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5229 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5228 | std::fmt::Display::fmt(self.syntax(), f) | 5230 | std::fmt::Display::fmt(self.syntax(), f) |
5229 | } | 5231 | } |
5230 | } | 5232 | } |
5231 | impl std::fmt::Display for MatchGuard { | 5233 | impl std::fmt::Display for MatchGuard { |
5232 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5234 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5233 | std::fmt::Display::fmt(self.syntax(), f) | 5235 | std::fmt::Display::fmt(self.syntax(), f) |
5234 | } | 5236 | } |
5235 | } | 5237 | } |
5236 | impl std::fmt::Display for RecordLit { | 5238 | impl std::fmt::Display for RecordLit { |
5237 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5239 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5238 | std::fmt::Display::fmt(self.syntax(), f) | 5240 | std::fmt::Display::fmt(self.syntax(), f) |
5239 | } | 5241 | } |
5240 | } | 5242 | } |
5241 | impl std::fmt::Display for RecordFieldList { | 5243 | impl std::fmt::Display for RecordFieldList { |
5242 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5244 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5243 | std::fmt::Display::fmt(self.syntax(), f) | 5245 | std::fmt::Display::fmt(self.syntax(), f) |
5244 | } | 5246 | } |
5245 | } | 5247 | } |
5246 | impl std::fmt::Display for RecordField { | 5248 | impl std::fmt::Display for RecordField { |
5247 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5249 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5248 | std::fmt::Display::fmt(self.syntax(), f) | 5250 | std::fmt::Display::fmt(self.syntax(), f) |
5249 | } | 5251 | } |
5250 | } | 5252 | } |
5251 | impl std::fmt::Display for OrPat { | 5253 | impl std::fmt::Display for OrPat { |
5252 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5254 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5253 | std::fmt::Display::fmt(self.syntax(), f) | 5255 | std::fmt::Display::fmt(self.syntax(), f) |
5254 | } | 5256 | } |
5255 | } | 5257 | } |
5256 | impl std::fmt::Display for ParenPat { | 5258 | impl std::fmt::Display for ParenPat { |
5257 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5259 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5258 | std::fmt::Display::fmt(self.syntax(), f) | 5260 | std::fmt::Display::fmt(self.syntax(), f) |
5259 | } | 5261 | } |
5260 | } | 5262 | } |
5261 | impl std::fmt::Display for RefPat { | 5263 | impl std::fmt::Display for RefPat { |
5262 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5264 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5263 | std::fmt::Display::fmt(self.syntax(), f) | 5265 | std::fmt::Display::fmt(self.syntax(), f) |
5264 | } | 5266 | } |
5265 | } | 5267 | } |
5266 | impl std::fmt::Display for BoxPat { | 5268 | impl std::fmt::Display for BoxPat { |
5267 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5269 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5268 | std::fmt::Display::fmt(self.syntax(), f) | 5270 | std::fmt::Display::fmt(self.syntax(), f) |
5269 | } | 5271 | } |
5270 | } | 5272 | } |
5271 | impl std::fmt::Display for BindPat { | 5273 | impl std::fmt::Display for BindPat { |
5272 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5274 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5273 | std::fmt::Display::fmt(self.syntax(), f) | 5275 | std::fmt::Display::fmt(self.syntax(), f) |
5274 | } | 5276 | } |
5275 | } | 5277 | } |
5276 | impl std::fmt::Display for PlaceholderPat { | 5278 | impl std::fmt::Display for PlaceholderPat { |
5277 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5279 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5278 | std::fmt::Display::fmt(self.syntax(), f) | 5280 | std::fmt::Display::fmt(self.syntax(), f) |
5279 | } | 5281 | } |
5280 | } | 5282 | } |
5281 | impl std::fmt::Display for DotDotPat { | 5283 | impl std::fmt::Display for DotDotPat { |
5282 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5284 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5283 | std::fmt::Display::fmt(self.syntax(), f) | 5285 | std::fmt::Display::fmt(self.syntax(), f) |
5284 | } | 5286 | } |
5285 | } | 5287 | } |
5286 | impl std::fmt::Display for PathPat { | 5288 | impl std::fmt::Display for PathPat { |
5287 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5289 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5288 | std::fmt::Display::fmt(self.syntax(), f) | 5290 | std::fmt::Display::fmt(self.syntax(), f) |
5289 | } | 5291 | } |
5290 | } | 5292 | } |
5291 | impl std::fmt::Display for SlicePat { | 5293 | impl std::fmt::Display for SlicePat { |
5292 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5294 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5293 | std::fmt::Display::fmt(self.syntax(), f) | 5295 | std::fmt::Display::fmt(self.syntax(), f) |
5294 | } | 5296 | } |
5295 | } | 5297 | } |
5296 | impl std::fmt::Display for RangePat { | 5298 | impl std::fmt::Display for RangePat { |
5297 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5299 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5298 | std::fmt::Display::fmt(self.syntax(), f) | 5300 | std::fmt::Display::fmt(self.syntax(), f) |
5299 | } | 5301 | } |
5300 | } | 5302 | } |
5301 | impl std::fmt::Display for LiteralPat { | 5303 | impl std::fmt::Display for LiteralPat { |
5302 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5304 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5303 | std::fmt::Display::fmt(self.syntax(), f) | 5305 | std::fmt::Display::fmt(self.syntax(), f) |
5304 | } | 5306 | } |
5305 | } | 5307 | } |
5306 | impl std::fmt::Display for MacroPat { | 5308 | impl std::fmt::Display for MacroPat { |
5307 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5309 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5308 | std::fmt::Display::fmt(self.syntax(), f) | 5310 | std::fmt::Display::fmt(self.syntax(), f) |
5309 | } | 5311 | } |
5310 | } | 5312 | } |
5311 | impl std::fmt::Display for RecordPat { | 5313 | impl std::fmt::Display for RecordPat { |
5312 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5314 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5313 | std::fmt::Display::fmt(self.syntax(), f) | 5315 | std::fmt::Display::fmt(self.syntax(), f) |
5314 | } | 5316 | } |
5315 | } | 5317 | } |
5316 | impl std::fmt::Display for RecordFieldPatList { | 5318 | impl std::fmt::Display for RecordFieldPatList { |
5317 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5319 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5318 | std::fmt::Display::fmt(self.syntax(), f) | 5320 | std::fmt::Display::fmt(self.syntax(), f) |
5319 | } | 5321 | } |
5320 | } | 5322 | } |
5321 | impl std::fmt::Display for RecordFieldPat { | 5323 | impl std::fmt::Display for RecordFieldPat { |
5322 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5324 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5323 | std::fmt::Display::fmt(self.syntax(), f) | 5325 | std::fmt::Display::fmt(self.syntax(), f) |
5324 | } | 5326 | } |
5325 | } | 5327 | } |
5326 | impl std::fmt::Display for TupleStructPat { | 5328 | impl std::fmt::Display for TupleStructPat { |
5327 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5329 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5328 | std::fmt::Display::fmt(self.syntax(), f) | 5330 | std::fmt::Display::fmt(self.syntax(), f) |
5329 | } | 5331 | } |
5330 | } | 5332 | } |
5331 | impl std::fmt::Display for TuplePat { | 5333 | impl std::fmt::Display for TuplePat { |
5332 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5334 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5333 | std::fmt::Display::fmt(self.syntax(), f) | 5335 | std::fmt::Display::fmt(self.syntax(), f) |
5334 | } | 5336 | } |
5335 | } | 5337 | } |
5336 | impl std::fmt::Display for Visibility { | 5338 | impl std::fmt::Display for Visibility { |
5337 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5339 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5338 | std::fmt::Display::fmt(self.syntax(), f) | 5340 | std::fmt::Display::fmt(self.syntax(), f) |
5339 | } | 5341 | } |
5340 | } | 5342 | } |
5341 | impl std::fmt::Display for Name { | 5343 | impl std::fmt::Display for Name { |
5342 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5344 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5343 | std::fmt::Display::fmt(self.syntax(), f) | 5345 | std::fmt::Display::fmt(self.syntax(), f) |
5344 | } | 5346 | } |
5345 | } | 5347 | } |
5346 | impl std::fmt::Display for NameRef { | 5348 | impl std::fmt::Display for NameRef { |
5347 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5349 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5348 | std::fmt::Display::fmt(self.syntax(), f) | 5350 | std::fmt::Display::fmt(self.syntax(), f) |
5349 | } | 5351 | } |
5350 | } | 5352 | } |
5351 | impl std::fmt::Display for MacroCall { | 5353 | impl std::fmt::Display for MacroCall { |
5352 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5354 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5353 | std::fmt::Display::fmt(self.syntax(), f) | 5355 | std::fmt::Display::fmt(self.syntax(), f) |
5354 | } | 5356 | } |
5355 | } | 5357 | } |
5356 | impl std::fmt::Display for Attr { | 5358 | impl std::fmt::Display for Attr { |
5357 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5359 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5358 | std::fmt::Display::fmt(self.syntax(), f) | 5360 | std::fmt::Display::fmt(self.syntax(), f) |
5359 | } | 5361 | } |
5360 | } | 5362 | } |
5361 | impl std::fmt::Display for TokenTree { | 5363 | impl std::fmt::Display for TokenTree { |
5362 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5364 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5363 | std::fmt::Display::fmt(self.syntax(), f) | 5365 | std::fmt::Display::fmt(self.syntax(), f) |
5364 | } | 5366 | } |
5365 | } | 5367 | } |
5366 | impl std::fmt::Display for TypeParamList { | 5368 | impl std::fmt::Display for TypeParamList { |
5367 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5369 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5368 | std::fmt::Display::fmt(self.syntax(), f) | 5370 | std::fmt::Display::fmt(self.syntax(), f) |
5369 | } | 5371 | } |
5370 | } | 5372 | } |
5371 | impl std::fmt::Display for TypeParam { | 5373 | impl std::fmt::Display for TypeParam { |
5372 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5374 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5373 | std::fmt::Display::fmt(self.syntax(), f) | 5375 | std::fmt::Display::fmt(self.syntax(), f) |
5374 | } | 5376 | } |
5375 | } | 5377 | } |
5376 | impl std::fmt::Display for ConstParam { | 5378 | impl std::fmt::Display for ConstParam { |
5377 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5379 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5378 | std::fmt::Display::fmt(self.syntax(), f) | 5380 | std::fmt::Display::fmt(self.syntax(), f) |
5379 | } | 5381 | } |
5380 | } | 5382 | } |
5381 | impl std::fmt::Display for LifetimeParam { | 5383 | impl std::fmt::Display for LifetimeParam { |
5382 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5384 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5383 | std::fmt::Display::fmt(self.syntax(), f) | 5385 | std::fmt::Display::fmt(self.syntax(), f) |
5384 | } | 5386 | } |
5385 | } | 5387 | } |
5386 | impl std::fmt::Display for TypeBound { | 5388 | impl std::fmt::Display for TypeBound { |
5387 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5389 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5388 | std::fmt::Display::fmt(self.syntax(), f) | 5390 | std::fmt::Display::fmt(self.syntax(), f) |
5389 | } | 5391 | } |
5390 | } | 5392 | } |
5391 | impl std::fmt::Display for TypeBoundList { | 5393 | impl std::fmt::Display for TypeBoundList { |
5392 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5394 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5393 | std::fmt::Display::fmt(self.syntax(), f) | 5395 | std::fmt::Display::fmt(self.syntax(), f) |
5394 | } | 5396 | } |
5395 | } | 5397 | } |
5396 | impl std::fmt::Display for WherePred { | 5398 | impl std::fmt::Display for WherePred { |
5397 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5399 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5398 | std::fmt::Display::fmt(self.syntax(), f) | 5400 | std::fmt::Display::fmt(self.syntax(), f) |
5399 | } | 5401 | } |
5400 | } | 5402 | } |
5401 | impl std::fmt::Display for WhereClause { | 5403 | impl std::fmt::Display for WhereClause { |
5402 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5404 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5403 | std::fmt::Display::fmt(self.syntax(), f) | 5405 | std::fmt::Display::fmt(self.syntax(), f) |
5404 | } | 5406 | } |
5405 | } | 5407 | } |
5406 | impl std::fmt::Display for Abi { | 5408 | impl std::fmt::Display for Abi { |
5407 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5409 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5408 | std::fmt::Display::fmt(self.syntax(), f) | 5410 | std::fmt::Display::fmt(self.syntax(), f) |
5409 | } | 5411 | } |
5410 | } | 5412 | } |
5411 | impl std::fmt::Display for ExprStmt { | 5413 | impl std::fmt::Display for ExprStmt { |
5412 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5414 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5413 | std::fmt::Display::fmt(self.syntax(), f) | 5415 | std::fmt::Display::fmt(self.syntax(), f) |
5414 | } | 5416 | } |
5415 | } | 5417 | } |
5416 | impl std::fmt::Display for LetStmt { | 5418 | impl std::fmt::Display for LetStmt { |
5417 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5419 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5418 | std::fmt::Display::fmt(self.syntax(), f) | 5420 | std::fmt::Display::fmt(self.syntax(), f) |
5419 | } | 5421 | } |
5420 | } | 5422 | } |
5421 | impl std::fmt::Display for Condition { | 5423 | impl std::fmt::Display for Condition { |
5422 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5424 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5423 | std::fmt::Display::fmt(self.syntax(), f) | 5425 | std::fmt::Display::fmt(self.syntax(), f) |
5424 | } | 5426 | } |
5425 | } | 5427 | } |
5426 | impl std::fmt::Display for ParamList { | 5428 | impl std::fmt::Display for ParamList { |
5427 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5429 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5428 | std::fmt::Display::fmt(self.syntax(), f) | 5430 | std::fmt::Display::fmt(self.syntax(), f) |
5429 | } | 5431 | } |
5430 | } | 5432 | } |
5431 | impl std::fmt::Display for SelfParam { | 5433 | impl std::fmt::Display for SelfParam { |
5432 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5434 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5433 | std::fmt::Display::fmt(self.syntax(), f) | 5435 | std::fmt::Display::fmt(self.syntax(), f) |
5434 | } | 5436 | } |
5435 | } | 5437 | } |
5436 | impl std::fmt::Display for Param { | 5438 | impl std::fmt::Display for Param { |
5437 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5439 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5438 | std::fmt::Display::fmt(self.syntax(), f) | 5440 | std::fmt::Display::fmt(self.syntax(), f) |
5439 | } | 5441 | } |
5440 | } | 5442 | } |
5441 | impl std::fmt::Display for UseItem { | 5443 | impl std::fmt::Display for UseItem { |
5442 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5444 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5443 | std::fmt::Display::fmt(self.syntax(), f) | 5445 | std::fmt::Display::fmt(self.syntax(), f) |
5444 | } | 5446 | } |
5445 | } | 5447 | } |
5446 | impl std::fmt::Display for UseTree { | 5448 | impl std::fmt::Display for UseTree { |
5447 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5449 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5448 | std::fmt::Display::fmt(self.syntax(), f) | 5450 | std::fmt::Display::fmt(self.syntax(), f) |
5449 | } | 5451 | } |
5450 | } | 5452 | } |
5451 | impl std::fmt::Display for Alias { | 5453 | impl std::fmt::Display for Alias { |
5452 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5454 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5453 | std::fmt::Display::fmt(self.syntax(), f) | 5455 | std::fmt::Display::fmt(self.syntax(), f) |
5454 | } | 5456 | } |
5455 | } | 5457 | } |
5456 | impl std::fmt::Display for UseTreeList { | 5458 | impl std::fmt::Display for UseTreeList { |
5457 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5459 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5458 | std::fmt::Display::fmt(self.syntax(), f) | 5460 | std::fmt::Display::fmt(self.syntax(), f) |
5459 | } | 5461 | } |
5460 | } | 5462 | } |
5461 | impl std::fmt::Display for ExternCrateItem { | 5463 | impl std::fmt::Display for ExternCrateItem { |
5462 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5464 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5463 | std::fmt::Display::fmt(self.syntax(), f) | 5465 | std::fmt::Display::fmt(self.syntax(), f) |
5464 | } | 5466 | } |
5465 | } | 5467 | } |
5466 | impl std::fmt::Display for ArgList { | 5468 | impl std::fmt::Display for ArgList { |
5467 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5469 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5468 | std::fmt::Display::fmt(self.syntax(), f) | 5470 | std::fmt::Display::fmt(self.syntax(), f) |
5469 | } | 5471 | } |
5470 | } | 5472 | } |
5471 | impl std::fmt::Display for Path { | 5473 | impl std::fmt::Display for Path { |
5472 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5474 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5473 | std::fmt::Display::fmt(self.syntax(), f) | 5475 | std::fmt::Display::fmt(self.syntax(), f) |
5474 | } | 5476 | } |
5475 | } | 5477 | } |
5476 | impl std::fmt::Display for PathSegment { | 5478 | impl std::fmt::Display for PathSegment { |
5477 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5479 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5478 | std::fmt::Display::fmt(self.syntax(), f) | 5480 | std::fmt::Display::fmt(self.syntax(), f) |
5479 | } | 5481 | } |
5480 | } | 5482 | } |
5481 | impl std::fmt::Display for TypeArgList { | 5483 | impl std::fmt::Display for TypeArgList { |
5482 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5484 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5483 | std::fmt::Display::fmt(self.syntax(), f) | 5485 | std::fmt::Display::fmt(self.syntax(), f) |
5484 | } | 5486 | } |
5485 | } | 5487 | } |
5486 | impl std::fmt::Display for TypeArg { | 5488 | impl std::fmt::Display for TypeArg { |
5487 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5489 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5488 | std::fmt::Display::fmt(self.syntax(), f) | 5490 | std::fmt::Display::fmt(self.syntax(), f) |
5489 | } | 5491 | } |
5490 | } | 5492 | } |
5491 | impl std::fmt::Display for AssocTypeArg { | 5493 | impl std::fmt::Display for AssocTypeArg { |
5492 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5494 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5493 | std::fmt::Display::fmt(self.syntax(), f) | 5495 | std::fmt::Display::fmt(self.syntax(), f) |
5494 | } | 5496 | } |
5495 | } | 5497 | } |
5496 | impl std::fmt::Display for LifetimeArg { | 5498 | impl std::fmt::Display for LifetimeArg { |
5497 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5499 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5498 | std::fmt::Display::fmt(self.syntax(), f) | 5500 | std::fmt::Display::fmt(self.syntax(), f) |
5499 | } | 5501 | } |
5500 | } | 5502 | } |
5501 | impl std::fmt::Display for ConstArg { | 5503 | impl std::fmt::Display for ConstArg { |
5502 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5504 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5503 | std::fmt::Display::fmt(self.syntax(), f) | 5505 | std::fmt::Display::fmt(self.syntax(), f) |
5504 | } | 5506 | } |
5505 | } | 5507 | } |
5506 | impl std::fmt::Display for MacroItems { | 5508 | impl std::fmt::Display for MacroItems { |
5507 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5509 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5508 | std::fmt::Display::fmt(self.syntax(), f) | 5510 | std::fmt::Display::fmt(self.syntax(), f) |
5509 | } | 5511 | } |
5510 | } | 5512 | } |
5511 | impl std::fmt::Display for MacroStmts { | 5513 | impl std::fmt::Display for MacroStmts { |
5512 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5514 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5513 | std::fmt::Display::fmt(self.syntax(), f) | 5515 | std::fmt::Display::fmt(self.syntax(), f) |
5514 | } | 5516 | } |
5515 | } | 5517 | } |
5516 | impl std::fmt::Display for ExternItemList { | 5518 | impl std::fmt::Display for ExternItemList { |
5517 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5519 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5518 | std::fmt::Display::fmt(self.syntax(), f) | 5520 | std::fmt::Display::fmt(self.syntax(), f) |
5519 | } | 5521 | } |
5520 | } | 5522 | } |
5521 | impl std::fmt::Display for ExternBlock { | 5523 | impl std::fmt::Display for ExternBlock { |
5522 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5524 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5523 | std::fmt::Display::fmt(self.syntax(), f) | 5525 | std::fmt::Display::fmt(self.syntax(), f) |
5524 | } | 5526 | } |
5525 | } | 5527 | } |
5526 | impl std::fmt::Display for MetaItem { | 5528 | impl std::fmt::Display for MetaItem { |
5527 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5529 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5528 | std::fmt::Display::fmt(self.syntax(), f) | 5530 | std::fmt::Display::fmt(self.syntax(), f) |
5529 | } | 5531 | } |
5530 | } | 5532 | } |
5531 | impl std::fmt::Display for MacroDef { | 5533 | impl std::fmt::Display for MacroDef { |
5532 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 5534 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
5533 | std::fmt::Display::fmt(self.syntax(), f) | 5535 | std::fmt::Display::fmt(self.syntax(), f) |
5534 | } | 5536 | } |
5535 | } | 5537 | } |
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs index f91befaac..abadd0b61 100644 --- a/crates/ra_syntax/src/ast/generated/tokens.rs +++ b/crates/ra_syntax/src/ast/generated/tokens.rs | |||
@@ -11,7 +11,7 @@ pub struct Whitespace { | |||
11 | pub(crate) syntax: SyntaxToken, | 11 | pub(crate) syntax: SyntaxToken, |
12 | } | 12 | } |
13 | impl std::fmt::Display for Whitespace { | 13 | impl std::fmt::Display for Whitespace { |
14 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 14 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
15 | std::fmt::Display::fmt(&self.syntax, f) | 15 | std::fmt::Display::fmt(&self.syntax, f) |
16 | } | 16 | } |
17 | } | 17 | } |
@@ -32,7 +32,7 @@ pub struct Comment { | |||
32 | pub(crate) syntax: SyntaxToken, | 32 | pub(crate) syntax: SyntaxToken, |
33 | } | 33 | } |
34 | impl std::fmt::Display for Comment { | 34 | impl std::fmt::Display for Comment { |
35 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 35 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
36 | std::fmt::Display::fmt(&self.syntax, f) | 36 | std::fmt::Display::fmt(&self.syntax, f) |
37 | } | 37 | } |
38 | } | 38 | } |
@@ -53,7 +53,7 @@ pub struct String { | |||
53 | pub(crate) syntax: SyntaxToken, | 53 | pub(crate) syntax: SyntaxToken, |
54 | } | 54 | } |
55 | impl std::fmt::Display for String { | 55 | impl std::fmt::Display for String { |
56 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 56 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
57 | std::fmt::Display::fmt(&self.syntax, f) | 57 | std::fmt::Display::fmt(&self.syntax, f) |
58 | } | 58 | } |
59 | } | 59 | } |
@@ -74,7 +74,7 @@ pub struct RawString { | |||
74 | pub(crate) syntax: SyntaxToken, | 74 | pub(crate) syntax: SyntaxToken, |
75 | } | 75 | } |
76 | impl std::fmt::Display for RawString { | 76 | impl std::fmt::Display for RawString { |
77 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 77 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
78 | std::fmt::Display::fmt(&self.syntax, f) | 78 | std::fmt::Display::fmt(&self.syntax, f) |
79 | } | 79 | } |
80 | } | 80 | } |
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index da0eb0926..192c610f1 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -75,6 +75,10 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordF | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { | ||
79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) | ||
80 | } | ||
81 | |||
78 | pub fn block_expr( | 82 | pub fn block_expr( |
79 | stmts: impl IntoIterator<Item = ast::Stmt>, | 83 | stmts: impl IntoIterator<Item = ast::Stmt>, |
80 | tail_expr: Option<ast::Expr>, | 84 | tail_expr: Option<ast::Expr>, |
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs index 3cd6d99c3..045f69133 100644 --- a/crates/ra_syntax/src/ast/tokens.rs +++ b/crates/ra_syntax/src/ast/tokens.rs | |||
@@ -1,6 +1,9 @@ | |||
1 | //! There are many AstNodes, but only a few tokens, so we hand-write them here. | 1 | //! There are many AstNodes, but only a few tokens, so we hand-write them here. |
2 | 2 | ||
3 | use std::convert::{TryFrom, TryInto}; | 3 | use std::{ |
4 | borrow::Cow, | ||
5 | convert::{TryFrom, TryInto}, | ||
6 | }; | ||
4 | 7 | ||
5 | use crate::{ | 8 | use crate::{ |
6 | ast::{AstToken, Comment, RawString, String, Whitespace}, | 9 | ast::{AstToken, Comment, RawString, String, Whitespace}, |
@@ -84,7 +87,7 @@ impl Whitespace { | |||
84 | } | 87 | } |
85 | 88 | ||
86 | pub struct QuoteOffsets { | 89 | pub struct QuoteOffsets { |
87 | pub quotes: [TextRange; 2], | 90 | pub quotes: (TextRange, TextRange), |
88 | pub contents: TextRange, | 91 | pub contents: TextRange, |
89 | } | 92 | } |
90 | 93 | ||
@@ -103,7 +106,7 @@ impl QuoteOffsets { | |||
103 | let end = TextSize::of(literal); | 106 | let end = TextSize::of(literal); |
104 | 107 | ||
105 | let res = QuoteOffsets { | 108 | let res = QuoteOffsets { |
106 | quotes: [TextRange::new(start, left_quote), TextRange::new(right_quote, end)], | 109 | quotes: (TextRange::new(start, left_quote), TextRange::new(right_quote, end)), |
107 | contents: TextRange::new(left_quote, right_quote), | 110 | contents: TextRange::new(left_quote, right_quote), |
108 | }; | 111 | }; |
109 | Some(res) | 112 | Some(res) |
@@ -116,17 +119,17 @@ pub trait HasQuotes: AstToken { | |||
116 | let offsets = QuoteOffsets::new(text)?; | 119 | let offsets = QuoteOffsets::new(text)?; |
117 | let o = self.syntax().text_range().start(); | 120 | let o = self.syntax().text_range().start(); |
118 | let offsets = QuoteOffsets { | 121 | let offsets = QuoteOffsets { |
119 | quotes: [offsets.quotes[0] + o, offsets.quotes[1] + o], | 122 | quotes: (offsets.quotes.0 + o, offsets.quotes.1 + o), |
120 | contents: offsets.contents + o, | 123 | contents: offsets.contents + o, |
121 | }; | 124 | }; |
122 | Some(offsets) | 125 | Some(offsets) |
123 | } | 126 | } |
124 | fn open_quote_text_range(&self) -> Option<TextRange> { | 127 | fn open_quote_text_range(&self) -> Option<TextRange> { |
125 | self.quote_offsets().map(|it| it.quotes[0]) | 128 | self.quote_offsets().map(|it| it.quotes.0) |
126 | } | 129 | } |
127 | 130 | ||
128 | fn close_quote_text_range(&self) -> Option<TextRange> { | 131 | fn close_quote_text_range(&self) -> Option<TextRange> { |
129 | self.quote_offsets().map(|it| it.quotes[1]) | 132 | self.quote_offsets().map(|it| it.quotes.1) |
130 | } | 133 | } |
131 | 134 | ||
132 | fn text_range_between_quotes(&self) -> Option<TextRange> { | 135 | fn text_range_between_quotes(&self) -> Option<TextRange> { |
@@ -138,11 +141,11 @@ impl HasQuotes for String {} | |||
138 | impl HasQuotes for RawString {} | 141 | impl HasQuotes for RawString {} |
139 | 142 | ||
140 | pub trait HasStringValue: HasQuotes { | 143 | pub trait HasStringValue: HasQuotes { |
141 | fn value(&self) -> Option<std::string::String>; | 144 | fn value(&self) -> Option<Cow<'_, str>>; |
142 | } | 145 | } |
143 | 146 | ||
144 | impl HasStringValue for String { | 147 | impl HasStringValue for String { |
145 | fn value(&self) -> Option<std::string::String> { | 148 | fn value(&self) -> Option<Cow<'_, str>> { |
146 | let text = self.text().as_str(); | 149 | let text = self.text().as_str(); |
147 | let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; | 150 | let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; |
148 | 151 | ||
@@ -156,15 +159,17 @@ impl HasStringValue for String { | |||
156 | if has_error { | 159 | if has_error { |
157 | return None; | 160 | return None; |
158 | } | 161 | } |
159 | Some(buf) | 162 | // FIXME: don't actually allocate for borrowed case |
163 | let res = if buf == text { Cow::Borrowed(text) } else { Cow::Owned(buf) }; | ||
164 | Some(res) | ||
160 | } | 165 | } |
161 | } | 166 | } |
162 | 167 | ||
163 | impl HasStringValue for RawString { | 168 | impl HasStringValue for RawString { |
164 | fn value(&self) -> Option<std::string::String> { | 169 | fn value(&self) -> Option<Cow<'_, str>> { |
165 | let text = self.text().as_str(); | 170 | let text = self.text().as_str(); |
166 | let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; | 171 | let text = &text[self.text_range_between_quotes()? - self.syntax().text_range().start()]; |
167 | Some(text.to_string()) | 172 | Some(Cow::Borrowed(text)) |
168 | } | 173 | } |
169 | } | 174 | } |
170 | 175 | ||
@@ -335,16 +340,26 @@ pub trait HasFormatSpecifier: AstToken { | |||
335 | } | 340 | } |
336 | c if c == '_' || c.is_alphabetic() => { | 341 | c if c == '_' || c.is_alphabetic() => { |
337 | read_identifier(&mut chars, &mut callback); | 342 | read_identifier(&mut chars, &mut callback); |
338 | if chars.peek().and_then(|next| next.1.as_ref().ok()).copied() | 343 | // can be either width (indicated by dollar sign, or type in which case |
339 | != Some('$') | 344 | // the next sign has to be `}`) |
340 | { | 345 | let next = |
341 | continue; | 346 | chars.peek().and_then(|next| next.1.as_ref().ok()).copied(); |
342 | } | 347 | match next { |
343 | skip_char_and_emit( | 348 | Some('$') => skip_char_and_emit( |
344 | &mut chars, | 349 | &mut chars, |
345 | FormatSpecifier::DollarSign, | 350 | FormatSpecifier::DollarSign, |
346 | &mut callback, | 351 | &mut callback, |
347 | ); | 352 | ), |
353 | Some('}') => { | ||
354 | skip_char_and_emit( | ||
355 | &mut chars, | ||
356 | FormatSpecifier::Close, | ||
357 | &mut callback, | ||
358 | ); | ||
359 | continue; | ||
360 | } | ||
361 | _ => continue, | ||
362 | }; | ||
348 | } | 363 | } |
349 | _ => {} | 364 | _ => {} |
350 | } | 365 | } |
@@ -416,17 +431,11 @@ pub trait HasFormatSpecifier: AstToken { | |||
416 | } | 431 | } |
417 | } | 432 | } |
418 | 433 | ||
419 | let mut cloned = chars.clone().take(2); | 434 | if let Some((_, Ok('}'))) = chars.peek() { |
420 | let first = cloned.next().and_then(|next| next.1.as_ref().ok()).copied(); | 435 | skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback); |
421 | let second = cloned.next().and_then(|next| next.1.as_ref().ok()).copied(); | 436 | } else { |
422 | if first != Some('}') { | ||
423 | continue; | ||
424 | } | ||
425 | if second == Some('}') { | ||
426 | // Escaped format end specifier, `}}` | ||
427 | continue; | 437 | continue; |
428 | } | 438 | } |
429 | skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback); | ||
430 | } | 439 | } |
431 | _ => { | 440 | _ => { |
432 | while let Some((_, Ok(next_char))) = chars.peek() { | 441 | while let Some((_, Ok(next_char))) = chars.peek() { |
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index bfc05e08b..a8f2454fd 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -83,13 +83,22 @@ pub trait DocCommentsOwner: AstNode { | |||
83 | CommentIter { iter: self.syntax().children_with_tokens() } | 83 | CommentIter { iter: self.syntax().children_with_tokens() } |
84 | } | 84 | } |
85 | 85 | ||
86 | fn doc_comment_text(&self) -> Option<String> { | ||
87 | self.doc_comments().doc_comment_text() | ||
88 | } | ||
89 | } | ||
90 | |||
91 | impl CommentIter { | ||
92 | pub fn from_syntax_node(syntax_node: &ast::SyntaxNode) -> CommentIter { | ||
93 | CommentIter { iter: syntax_node.children_with_tokens() } | ||
94 | } | ||
95 | |||
86 | /// Returns the textual content of a doc comment block as a single string. | 96 | /// Returns the textual content of a doc comment block as a single string. |
87 | /// That is, strips leading `///` (+ optional 1 character of whitespace), | 97 | /// That is, strips leading `///` (+ optional 1 character of whitespace), |
88 | /// trailing `*/`, trailing whitespace and then joins the lines. | 98 | /// trailing `*/`, trailing whitespace and then joins the lines. |
89 | fn doc_comment_text(&self) -> Option<String> { | 99 | pub fn doc_comment_text(self) -> Option<String> { |
90 | let mut has_comments = false; | 100 | let mut has_comments = false; |
91 | let docs = self | 101 | let docs = self |
92 | .doc_comments() | ||
93 | .filter(|comment| comment.kind().doc.is_some()) | 102 | .filter(|comment| comment.kind().doc.is_some()) |
94 | .map(|comment| { | 103 | .map(|comment| { |
95 | has_comments = true; | 104 | has_comments = true; |