diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-23 21:40:39 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-23 21:40:39 +0100 |
commit | e0864c9c153c88a4bc3b75d0cc5501678a21183a (patch) | |
tree | 9f2780683eb264a06b920bbe22d5da841531f15e | |
parent | 16054887102104208f4a0fc0e75e702b85a2eae8 (diff) | |
parent | 8d5f59e0f120ed32f92a0c99c780d28af4eab879 (diff) |
Merge #8950
8950: minor: align import style with styleguide r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | crates/ide_db/src/ty_filter.rs | 6 | ||||
-rw-r--r-- | editors/code/src/snippets.ts | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/crates/ide_db/src/ty_filter.rs b/crates/ide_db/src/ty_filter.rs index 00678bf3e..766d8c628 100644 --- a/crates/ide_db/src/ty_filter.rs +++ b/crates/ide_db/src/ty_filter.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | use std::iter; | 5 | use std::iter; |
6 | 6 | ||
7 | use hir::{Adt, Semantics, Type}; | 7 | use hir::Semantics; |
8 | use syntax::ast::{self, make}; | 8 | use syntax::ast::{self, make}; |
9 | 9 | ||
10 | use crate::RootDatabase; | 10 | use crate::RootDatabase; |
@@ -20,9 +20,9 @@ impl TryEnum { | |||
20 | const ALL: [TryEnum; 2] = [TryEnum::Option, TryEnum::Result]; | 20 | const ALL: [TryEnum; 2] = [TryEnum::Option, TryEnum::Result]; |
21 | 21 | ||
22 | /// Returns `Some(..)` if the provided type is an enum that implements `std::ops::Try`. | 22 | /// Returns `Some(..)` if the provided type is an enum that implements `std::ops::Try`. |
23 | pub fn from_ty(sema: &Semantics<RootDatabase>, ty: &Type) -> Option<TryEnum> { | 23 | pub fn from_ty(sema: &Semantics<RootDatabase>, ty: &hir::Type) -> Option<TryEnum> { |
24 | let enum_ = match ty.as_adt() { | 24 | let enum_ = match ty.as_adt() { |
25 | Some(Adt::Enum(it)) => it, | 25 | Some(hir::Adt::Enum(it)) => it, |
26 | _ => return None, | 26 | _ => return None, |
27 | }; | 27 | }; |
28 | TryEnum::ALL.iter().find_map(|&var| { | 28 | TryEnum::ALL.iter().find_map(|&var| { |
diff --git a/editors/code/src/snippets.ts b/editors/code/src/snippets.ts index 9561aa345..58f7aa128 100644 --- a/editors/code/src/snippets.ts +++ b/editors/code/src/snippets.ts | |||
@@ -56,6 +56,9 @@ export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vs | |||
56 | } | 56 | } |
57 | }); | 57 | }); |
58 | if (selections.length > 0) editor.selections = selections; | 58 | if (selections.length > 0) editor.selections = selections; |
59 | if (selections.length === 1) { | ||
60 | editor.revealRange(selections[0], vscode.TextEditorRevealType.InCenterIfOutsideViewport); | ||
61 | } | ||
59 | } | 62 | } |
60 | 63 | ||
61 | function parseSnippet(snip: string): [string, [number, number]] | undefined { | 64 | function parseSnippet(snip: string): [string, [number, number]] | undefined { |