Skip to content

Commit d26657b

Browse files
committed
fix rust fmt
1 parent ff759e7 commit d26657b

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

crates/ide/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,7 @@ impl Analysis {
554554
}
555555

556556
/// Returns the single selected test for the given file position.
557-
pub fn selected_test(
558-
&self,
559-
position: FilePosition,
560-
) -> Cancellable<Option<Runnable>> {
557+
pub fn selected_test(&self, position: FilePosition) -> Cancellable<Option<Runnable>> {
561558
self.with_db(|db| runnables::selected_test(db, position))
562559
}
563560

crates/ide/src/runnables.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
206206
// | VS Code | **rust-analyzer: Run Selected**
207207
// | VS Code | **rust-analyzer: Debug Selected**
208208
// |===
209-
pub(crate) fn selected_test(
210-
db: &RootDatabase,
211-
position: FilePosition
212-
) -> Option<Runnable> {
209+
pub(crate) fn selected_test(db: &RootDatabase, position: FilePosition) -> Option<Runnable> {
213210
let sema = Semantics::new(db);
214211
let syntax = sema.parse(position.file_id).syntax().clone();
215212
return find_selected_test(&sema, &syntax, position);
@@ -218,16 +215,19 @@ pub(crate) fn selected_test(
218215
fn find_selected_test(
219216
sema: &Semantics<'_, RootDatabase>,
220217
syntax: &SyntaxNode,
221-
position: FilePosition
218+
position: FilePosition,
222219
) -> Option<Runnable> {
223-
syntax.token_at_offset(position.offset)
220+
syntax
221+
.token_at_offset(position.offset)
224222
.find(|_| true)
225223
.and_then(|token| token.parent())
226-
.and_then(|node| node.ancestors().find_map(|ancestor| {
227-
let fn_def = ast::Fn::cast(ancestor.clone())?;
228-
test_related_attribute(&fn_def)?;
229-
as_test_runnable(sema, &fn_def)
230-
}))
224+
.and_then(|node| {
225+
node.ancestors().find_map(|ancestor| {
226+
let fn_def = ast::Fn::cast(ancestor.clone())?;
227+
test_related_attribute(&fn_def)?;
228+
as_test_runnable(sema, &fn_def)
229+
})
230+
})
231231
}
232232

233233
// Feature: Related Tests

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,7 @@ pub(crate) fn handle_selected_test(
840840

841841
let test = snap.analysis.selected_test(position)?;
842842
let res = test.and_then(|test| {
843-
to_proto::runnable(&snap, test)
844-
.ok()
845-
.map(|runnable| lsp_ext::TestInfo { runnable })
843+
to_proto::runnable(&snap, test).ok().map(|runnable| lsp_ext::TestInfo { runnable })
846844
});
847845

848846
Ok(res)

0 commit comments

Comments
 (0)