mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Refactor SSR so that placeholders store a Var
This allows lookup of placeholder bindings given a placeholder without needing to create a Var instance.
This commit is contained in:
parent
674af600f1
commit
c84f98385a
4 changed files with 26 additions and 18 deletions
|
@ -1,6 +1,5 @@
|
|||
//! Code for applying replacement templates for matches that have previously been found.
|
||||
|
||||
use crate::matching::Var;
|
||||
use crate::{resolving::ResolvedRule, Match, SsrMatches};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use syntax::ast::{self, AstToken};
|
||||
|
@ -114,7 +113,7 @@ impl ReplacementRenderer<'_> {
|
|||
fn render_token(&mut self, token: &SyntaxToken) {
|
||||
if let Some(placeholder) = self.rule.get_placeholder(&token) {
|
||||
if let Some(placeholder_value) =
|
||||
self.match_info.placeholder_values.get(&Var(placeholder.ident.to_string()))
|
||||
self.match_info.placeholder_values.get(&placeholder.ident)
|
||||
{
|
||||
let range = &placeholder_value.range.range;
|
||||
let mut matched_text =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue