diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-19 14:12:07 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-19 14:12:07 +0000 |
commit | 067d22b61bc15e60d91677e2528f3fbdfafad877 (patch) | |
tree | 7675fa96ea2df477f30d7e6acb060ed379b86ef1 /crates/ide/src/syntax_highlighting/tags.rs | |
parent | bd270cbc024f56596c315061d10732ebbe16eef9 (diff) | |
parent | a13947abe62a44c4ffa802be54e041a3d18e7f2b (diff) |
Merge #6947
6947: Use more Rustic highlighting specifiers r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tags.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/tags.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index e0117a6b2..1b3b31747 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs | |||
@@ -33,8 +33,7 @@ pub enum HighlightTag { | |||
33 | Operator, | 33 | Operator, |
34 | UnresolvedReference, | 34 | UnresolvedReference, |
35 | 35 | ||
36 | // FIXME: this two are random and don't fit with the others | 36 | // FIXME: this one is random and don't fit with the others |
37 | Method, | ||
38 | Generic, | 37 | Generic, |
39 | } | 38 | } |
40 | 39 | ||
@@ -56,6 +55,8 @@ pub enum HighlightModifier { | |||
56 | Callable, | 55 | Callable, |
57 | /// Used for associated functions | 56 | /// Used for associated functions |
58 | Static, | 57 | Static, |
58 | /// Used for items in impls&traits. | ||
59 | Associated, | ||
59 | } | 60 | } |
60 | 61 | ||
61 | impl HighlightTag { | 62 | impl HighlightTag { |
@@ -92,7 +93,6 @@ impl HighlightTag { | |||
92 | HighlightTag::Generic => "generic", | 93 | HighlightTag::Generic => "generic", |
93 | HighlightTag::Keyword => "keyword", | 94 | HighlightTag::Keyword => "keyword", |
94 | HighlightTag::Punctuation => "punctuation", | 95 | HighlightTag::Punctuation => "punctuation", |
95 | HighlightTag::Method => "method", | ||
96 | HighlightTag::NumericLiteral => "numeric_literal", | 96 | HighlightTag::NumericLiteral => "numeric_literal", |
97 | HighlightTag::Operator => "operator", | 97 | HighlightTag::Operator => "operator", |
98 | HighlightTag::StringLiteral => "string_literal", | 98 | HighlightTag::StringLiteral => "string_literal", |
@@ -133,6 +133,7 @@ impl HighlightModifier { | |||
133 | HighlightModifier::Unsafe => "unsafe", | 133 | HighlightModifier::Unsafe => "unsafe", |
134 | HighlightModifier::Callable => "callable", | 134 | HighlightModifier::Callable => "callable", |
135 | HighlightModifier::Static => "static", | 135 | HighlightModifier::Static => "static", |
136 | HighlightModifier::Associated => "associated", | ||
136 | } | 137 | } |
137 | } | 138 | } |
138 | 139 | ||
@@ -199,6 +200,10 @@ impl ops::BitOr<HighlightModifier> for Highlight { | |||
199 | } | 200 | } |
200 | 201 | ||
201 | impl HighlightModifiers { | 202 | impl HighlightModifiers { |
203 | pub fn contains(self, m: HighlightModifier) -> bool { | ||
204 | self.0 & m.mask() == m.mask() | ||
205 | } | ||
206 | |||
202 | pub fn iter(self) -> impl Iterator<Item = HighlightModifier> { | 207 | pub fn iter(self) -> impl Iterator<Item = HighlightModifier> { |
203 | HighlightModifier::ALL.iter().copied().filter(move |it| self.0 & it.mask() == it.mask()) | 208 | HighlightModifier::ALL.iter().copied().filter(move |it| self.0 & it.mask() == it.mask()) |
204 | } | 209 | } |