@@ -5,7 +5,7 @@ use ra_ide_db::RootDatabase;
5
5
use ra_prof:: profile;
6
6
use ra_syntax:: {
7
7
ast:: { self , ArgListOwner , AstNode , TypeAscriptionOwner } ,
8
- match_ast, SmolStr , TextRange , NodeOrToken , SyntaxKind , Direction
8
+ match_ast, Direction , NodeOrToken , SmolStr , SyntaxKind , TextRange ,
9
9
} ;
10
10
11
11
use crate :: { FileId , FunctionSignature } ;
@@ -20,12 +20,7 @@ pub struct InlayHintsOptions {
20
20
21
21
impl Default for InlayHintsOptions {
22
22
fn default ( ) -> Self {
23
- Self {
24
- type_hints : true ,
25
- parameter_hints : true ,
26
- chaining_hints : true ,
27
- max_length : None
28
- }
23
+ Self { type_hints : true , parameter_hints : true , chaining_hints : true , max_length : None }
29
24
}
30
25
}
31
26
@@ -86,7 +81,8 @@ fn get_chaining_hints(
86
81
return None ;
87
82
}
88
83
89
- let mut tokens = expr. syntax ( )
84
+ let mut tokens = expr
85
+ . syntax ( )
90
86
. siblings_with_tokens ( Direction :: Next )
91
87
. filter_map ( NodeOrToken :: into_token)
92
88
. filter ( |t| match t. kind ( ) {
@@ -99,7 +95,7 @@ fn get_chaining_hints(
99
95
// Ignoring extra whitespace and comments
100
96
let next = tokens. next ( ) ?. kind ( ) ;
101
97
let next_next = tokens. next ( ) ?. kind ( ) ;
102
- if next == SyntaxKind :: WHITESPACE && next_next == SyntaxKind :: DOT {
98
+ if next == SyntaxKind :: WHITESPACE && next_next == SyntaxKind :: DOT {
103
99
acc. push ( InlayHint {
104
100
range : expr. syntax ( ) . text_range ( ) ,
105
101
kind : InlayKind :: ChainingHint ,
@@ -1190,11 +1186,11 @@ fn main() {
1190
1186
fn generic_chaining_hints ( ) {
1191
1187
let ( analysis, file_id) = single_file (
1192
1188
r#"
1193
- struct A<T>(T);
1189
+ struct A<T>(T);
1194
1190
struct B<T>(T);
1195
1191
struct C<T>(T);
1196
1192
struct X<T,R>(T, R);
1197
-
1193
+
1198
1194
impl<T> A<T> {
1199
1195
fn new(t: T) -> Self { A(t) }
1200
1196
fn into_b(self) -> B<T> { B(self.0) }
@@ -1211,12 +1207,12 @@ fn main() {
1211
1207
assert_debug_snapshot ! ( analysis. inlay_hints( file_id, & InlayHintsOptions { parameter_hints: false , type_hints: false , chaining_hints: true , max_length: None } ) . unwrap( ) , @r###"
1212
1208
[
1213
1209
InlayHint {
1214
- range: [416; 465 ),
1210
+ range: [403; 452 ),
1215
1211
kind: ChainingHint,
1216
1212
label: "B<X<i32, bool>>",
1217
1213
},
1218
1214
InlayHint {
1219
- range: [416; 435 ),
1215
+ range: [403; 422 ),
1220
1216
kind: ChainingHint,
1221
1217
label: "A<X<i32, bool>>",
1222
1218
},
0 commit comments