mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Default::default the highlighters
This commit is contained in:
parent
8c6dc5f28a
commit
bab29e65eb
3 changed files with 7 additions and 18 deletions
|
@ -12,10 +12,6 @@ pub(super) struct FormatStringHighlighter {
|
|||
}
|
||||
|
||||
impl FormatStringHighlighter {
|
||||
pub(super) fn reset(&mut self) {
|
||||
self.format_string = None;
|
||||
}
|
||||
|
||||
pub(super) fn check_for_format_string(&mut self, parent: &SyntaxNode) {
|
||||
// Check if macro takes a format string and remember it for highlighting later.
|
||||
// The macros that accept a format string expand to a compiler builtin macros
|
||||
|
|
|
@ -3,21 +3,14 @@ use syntax::{SyntaxElement, SyntaxKind, SyntaxToken, TextRange, T};
|
|||
|
||||
use crate::{HighlightTag, HighlightedRange};
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct MacroRulesHighlighter {
|
||||
state: Option<MacroMatcherParseState>,
|
||||
}
|
||||
|
||||
impl MacroRulesHighlighter {
|
||||
pub(super) fn new() -> Self {
|
||||
MacroRulesHighlighter { state: None }
|
||||
}
|
||||
|
||||
pub(super) fn init(&mut self) {
|
||||
self.state = Some(MacroMatcherParseState::new());
|
||||
}
|
||||
|
||||
pub(super) fn reset(&mut self) {
|
||||
self.state = None;
|
||||
self.state = Some(MacroMatcherParseState::default());
|
||||
}
|
||||
|
||||
pub(super) fn advance(&mut self, token: &SyntaxToken) {
|
||||
|
@ -51,8 +44,8 @@ struct MacroMatcherParseState {
|
|||
in_invoc_body: bool,
|
||||
}
|
||||
|
||||
impl MacroMatcherParseState {
|
||||
fn new() -> Self {
|
||||
impl Default for MacroMatcherParseState {
|
||||
fn default() -> Self {
|
||||
MacroMatcherParseState {
|
||||
paren_ty: None,
|
||||
paren_level: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue