@@ -61,9 +61,6 @@ pub struct Match {
6161/// Information about a placeholder bound in a match.
6262#[ derive( Debug ) ]
6363pub ( crate ) struct PlaceholderMatch {
64- /// The node that the placeholder matched to. If set, then we'll search for further matches
65- /// within this node. It isn't set when we match tokens within a macro call's token tree.
66- pub ( crate ) node : Option < SyntaxNode > ,
6764 pub ( crate ) range : FileRange ,
6865 /// More matches, found within `node`.
6966 pub ( crate ) inner_matches : SsrMatches ,
@@ -186,7 +183,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
186183 self . validate_range ( & original_range) ?;
187184 matches_out. placeholder_values . insert (
188185 placeholder. ident . clone ( ) ,
189- PlaceholderMatch :: new ( Some ( code ) , original_range) ,
186+ PlaceholderMatch :: from_range ( original_range) ,
190187 ) ;
191188 }
192189 return Ok ( ( ) ) ;
@@ -715,19 +712,14 @@ fn recording_match_fail_reasons() -> bool {
715712}
716713
717714impl PlaceholderMatch {
718- fn new ( node : Option < & SyntaxNode > , range : FileRange ) -> Self {
715+ fn from_range ( range : FileRange ) -> Self {
719716 Self {
720- node : node. cloned ( ) ,
721717 range,
722718 inner_matches : SsrMatches :: default ( ) ,
723719 autoderef_count : 0 ,
724720 autoref_kind : ast:: SelfParamKind :: Owned ,
725721 }
726722 }
727-
728- fn from_range ( range : FileRange ) -> Self {
729- Self :: new ( None , range)
730- }
731723}
732724
733725impl NodeKind {
@@ -788,7 +780,6 @@ impl PatternIterator {
788780
789781#[ cfg( test) ]
790782mod tests {
791- use super :: * ;
792783 use crate :: { MatchFinder , SsrRule } ;
793784
794785 #[ test]
@@ -803,14 +794,6 @@ mod tests {
803794 assert_eq ! ( matches. matches. len( ) , 1 ) ;
804795 assert_eq ! ( matches. matches[ 0 ] . matched_node. text( ) , "foo(1+2)" ) ;
805796 assert_eq ! ( matches. matches[ 0 ] . placeholder_values. len( ) , 1 ) ;
806- assert_eq ! (
807- matches. matches[ 0 ] . placeholder_values[ & Var ( "x" . to_string( ) ) ]
808- . node
809- . as_ref( )
810- . unwrap( )
811- . text( ) ,
812- "1+2"
813- ) ;
814797
815798 let edits = match_finder. edits ( ) ;
816799 assert_eq ! ( edits. len( ) , 1 ) ;
0 commit comments