diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 22 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 04746ef8f..667a9294f 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -390,7 +390,7 @@ impl ast::MatchArmList { | |||
390 | #[must_use] | 390 | #[must_use] |
391 | pub fn remove_placeholder(&self) -> ast::MatchArmList { | 391 | pub fn remove_placeholder(&self) -> ast::MatchArmList { |
392 | let placeholder = | 392 | let placeholder = |
393 | self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::PlaceholderPat(_)))); | 393 | self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::WildcardPat(_)))); |
394 | if let Some(placeholder) = placeholder { | 394 | if let Some(placeholder) = placeholder { |
395 | self.remove_arm(&placeholder) | 395 | self.remove_arm(&placeholder) |
396 | } else { | 396 | } else { |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 713aebcfa..f6b3fa6ef 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -1175,10 +1175,10 @@ impl PathPat { | |||
1175 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1175 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1176 | } | 1176 | } |
1177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1178 | pub struct PlaceholderPat { | 1178 | pub struct WildcardPat { |
1179 | pub(crate) syntax: SyntaxNode, | 1179 | pub(crate) syntax: SyntaxNode, |
1180 | } | 1180 | } |
1181 | impl PlaceholderPat { | 1181 | impl WildcardPat { |
1182 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1182 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1183 | } | 1183 | } |
1184 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1184 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1343,7 +1343,7 @@ pub enum Pat { | |||
1343 | OrPat(OrPat), | 1343 | OrPat(OrPat), |
1344 | ParenPat(ParenPat), | 1344 | ParenPat(ParenPat), |
1345 | PathPat(PathPat), | 1345 | PathPat(PathPat), |
1346 | PlaceholderPat(PlaceholderPat), | 1346 | WildcardPat(WildcardPat), |
1347 | RangePat(RangePat), | 1347 | RangePat(RangePat), |
1348 | RecordPat(RecordPat), | 1348 | RecordPat(RecordPat), |
1349 | RefPat(RefPat), | 1349 | RefPat(RefPat), |
@@ -2644,8 +2644,8 @@ impl AstNode for PathPat { | |||
2644 | } | 2644 | } |
2645 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2645 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2646 | } | 2646 | } |
2647 | impl AstNode for PlaceholderPat { | 2647 | impl AstNode for WildcardPat { |
2648 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } | 2648 | fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT } |
2649 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2649 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2650 | if Self::can_cast(syntax.kind()) { | 2650 | if Self::can_cast(syntax.kind()) { |
2651 | Some(Self { syntax }) | 2651 | Some(Self { syntax }) |
@@ -3160,8 +3160,8 @@ impl From<ParenPat> for Pat { | |||
3160 | impl From<PathPat> for Pat { | 3160 | impl From<PathPat> for Pat { |
3161 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } | 3161 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } |
3162 | } | 3162 | } |
3163 | impl From<PlaceholderPat> for Pat { | 3163 | impl From<WildcardPat> for Pat { |
3164 | fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } | 3164 | fn from(node: WildcardPat) -> Pat { Pat::WildcardPat(node) } |
3165 | } | 3165 | } |
3166 | impl From<RangePat> for Pat { | 3166 | impl From<RangePat> for Pat { |
3167 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } | 3167 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } |
@@ -3185,7 +3185,7 @@ impl AstNode for Pat { | |||
3185 | fn can_cast(kind: SyntaxKind) -> bool { | 3185 | fn can_cast(kind: SyntaxKind) -> bool { |
3186 | match kind { | 3186 | match kind { |
3187 | BIND_PAT | BOX_PAT | DOT_DOT_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT | 3187 | BIND_PAT | BOX_PAT | DOT_DOT_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT |
3188 | | PATH_PAT | PLACEHOLDER_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT | 3188 | | PATH_PAT | WILDCARD_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT |
3189 | | TUPLE_PAT | TUPLE_STRUCT_PAT => true, | 3189 | | TUPLE_PAT | TUPLE_STRUCT_PAT => true, |
3190 | _ => false, | 3190 | _ => false, |
3191 | } | 3191 | } |
@@ -3200,7 +3200,7 @@ impl AstNode for Pat { | |||
3200 | OR_PAT => Pat::OrPat(OrPat { syntax }), | 3200 | OR_PAT => Pat::OrPat(OrPat { syntax }), |
3201 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), | 3201 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), |
3202 | PATH_PAT => Pat::PathPat(PathPat { syntax }), | 3202 | PATH_PAT => Pat::PathPat(PathPat { syntax }), |
3203 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | 3203 | WILDCARD_PAT => Pat::WildcardPat(WildcardPat { syntax }), |
3204 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), | 3204 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), |
3205 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), | 3205 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), |
3206 | REF_PAT => Pat::RefPat(RefPat { syntax }), | 3206 | REF_PAT => Pat::RefPat(RefPat { syntax }), |
@@ -3221,7 +3221,7 @@ impl AstNode for Pat { | |||
3221 | Pat::OrPat(it) => &it.syntax, | 3221 | Pat::OrPat(it) => &it.syntax, |
3222 | Pat::ParenPat(it) => &it.syntax, | 3222 | Pat::ParenPat(it) => &it.syntax, |
3223 | Pat::PathPat(it) => &it.syntax, | 3223 | Pat::PathPat(it) => &it.syntax, |
3224 | Pat::PlaceholderPat(it) => &it.syntax, | 3224 | Pat::WildcardPat(it) => &it.syntax, |
3225 | Pat::RangePat(it) => &it.syntax, | 3225 | Pat::RangePat(it) => &it.syntax, |
3226 | Pat::RecordPat(it) => &it.syntax, | 3226 | Pat::RecordPat(it) => &it.syntax, |
3227 | Pat::RefPat(it) => &it.syntax, | 3227 | Pat::RefPat(it) => &it.syntax, |
@@ -4021,7 +4021,7 @@ impl std::fmt::Display for PathPat { | |||
4021 | std::fmt::Display::fmt(self.syntax(), f) | 4021 | std::fmt::Display::fmt(self.syntax(), f) |
4022 | } | 4022 | } |
4023 | } | 4023 | } |
4024 | impl std::fmt::Display for PlaceholderPat { | 4024 | impl std::fmt::Display for WildcardPat { |
4025 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4025 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4026 | std::fmt::Display::fmt(self.syntax(), f) | 4026 | std::fmt::Display::fmt(self.syntax(), f) |
4027 | } | 4027 | } |
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 3d4fed64c..efb2cb4a3 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -156,10 +156,10 @@ pub fn bind_pat(name: ast::Name) -> ast::BindPat { | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | pub fn placeholder_pat() -> ast::PlaceholderPat { | 159 | pub fn placeholder_pat() -> ast::WildcardPat { |
160 | return from_text("_"); | 160 | return from_text("_"); |
161 | 161 | ||
162 | fn from_text(text: &str) -> ast::PlaceholderPat { | 162 | fn from_text(text: &str) -> ast::WildcardPat { |
163 | ast_from_text(&format!("fn f({}: ())", text)) | 163 | ast_from_text(&format!("fn f({}: ())", text)) |
164 | } | 164 | } |
165 | } | 165 | } |