From 9d298115a62343e207992bbceb0279522324bf75 Mon Sep 17 00:00:00 2001 From: Matt Hooper Date: Tue, 24 Mar 2020 20:31:02 +0100 Subject: Fmt corrections --- crates/ra_ide/src/inlay_hints.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 293944206..07aab45ee 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs @@ -5,7 +5,7 @@ use ra_ide_db::RootDatabase; use ra_prof::profile; use ra_syntax::{ ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, - match_ast, SmolStr, TextRange, NodeOrToken, SyntaxKind, Direction + match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, }; use crate::{FileId, FunctionSignature}; @@ -20,12 +20,7 @@ pub struct InlayHintsOptions { impl Default for InlayHintsOptions { fn default() -> Self { - Self { - type_hints: true, - parameter_hints: true, - chaining_hints: true, - max_length: None - } + Self { type_hints: true, parameter_hints: true, chaining_hints: true, max_length: None } } } @@ -86,7 +81,8 @@ fn get_chaining_hints( return None; } - let mut tokens = expr.syntax() + let mut tokens = expr + .syntax() .siblings_with_tokens(Direction::Next) .filter_map(NodeOrToken::into_token) .filter(|t| match t.kind() { @@ -99,7 +95,7 @@ fn get_chaining_hints( // Ignoring extra whitespace and comments let next = tokens.next()?.kind(); let next_next = tokens.next()?.kind(); - if next == SyntaxKind::WHITESPACE && next_next == SyntaxKind::DOT { + if next == SyntaxKind::WHITESPACE && next_next == SyntaxKind::DOT { acc.push(InlayHint { range: expr.syntax().text_range(), kind: InlayKind::ChainingHint, @@ -1190,11 +1186,11 @@ fn main() { fn generic_chaining_hints() { let (analysis, file_id) = single_file( r#" - struct A(T); + struct A(T); struct B(T); struct C(T); struct X(T, R); - + impl A { fn new(t: T) -> Self { A(t) } fn into_b(self) -> B { B(self.0) } @@ -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###" [ InlayHint { - range: [416; 465), + range: [403; 452), kind: ChainingHint, label: "B>", }, InlayHint { - range: [416; 435), + range: [403; 422), kind: ChainingHint, label: "A>", }, -- cgit v1.2.3