Fmt corrections

This commit is contained in:
Matt Hooper 2020-03-24 20:31:02 +01:00
parent b70ce559b8
commit 9d298115a6

View file

@ -5,7 +5,7 @@ use ra_ide_db::RootDatabase;
use ra_prof::profile; use ra_prof::profile;
use ra_syntax::{ use ra_syntax::{
ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner},
match_ast, SmolStr, TextRange, NodeOrToken, SyntaxKind, Direction match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange,
}; };
use crate::{FileId, FunctionSignature}; use crate::{FileId, FunctionSignature};
@ -20,12 +20,7 @@ pub struct InlayHintsOptions {
impl Default for InlayHintsOptions { impl Default for InlayHintsOptions {
fn default() -> Self { fn default() -> Self {
Self { Self { type_hints: true, parameter_hints: true, chaining_hints: true, max_length: None }
type_hints: true,
parameter_hints: true,
chaining_hints: true,
max_length: None
}
} }
} }
@ -86,7 +81,8 @@ fn get_chaining_hints(
return None; return None;
} }
let mut tokens = expr.syntax() let mut tokens = expr
.syntax()
.siblings_with_tokens(Direction::Next) .siblings_with_tokens(Direction::Next)
.filter_map(NodeOrToken::into_token) .filter_map(NodeOrToken::into_token)
.filter(|t| match t.kind() { .filter(|t| match t.kind() {
@ -1211,12 +1207,12 @@ fn main() {
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintsOptions{ parameter_hints: false, type_hints: false, chaining_hints: true, max_length: None}).unwrap(), @r###" assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintsOptions{ parameter_hints: false, type_hints: false, chaining_hints: true, max_length: None}).unwrap(), @r###"
[ [
InlayHint { InlayHint {
range: [416; 465), range: [403; 452),
kind: ChainingHint, kind: ChainingHint,
label: "B<X<i32, bool>>", label: "B<X<i32, bool>>",
}, },
InlayHint { InlayHint {
range: [416; 435), range: [403; 422),
kind: ChainingHint, kind: ChainingHint,
label: "A<X<i32, bool>>", label: "A<X<i32, bool>>",
}, },