Skip to content

Commit 4f6f393

Browse files
theotherphilmatklad
authored andcommitted
cargo format
1 parent 456e72c commit 4f6f393

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

crates/ra_hir/src/expr/validation.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
name,
1313
path::{PathKind, PathSegment},
1414
ty::{InferenceResult, Ty, TypeCtor},
15-
Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution
15+
Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution,
1616
};
1717
use ra_syntax::ast;
1818

@@ -116,26 +116,25 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
116116
PathSegment { name: name::STD, args_and_bindings: None },
117117
PathSegment { name: name::RESULT_MOD, args_and_bindings: None },
118118
PathSegment { name: name::RESULT_TYPE, args_and_bindings: None },
119-
]
119+
],
120120
};
121121

122122
let resolver = self.func.resolver(db);
123-
let std_result_enum = match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() {
124-
PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e,
125-
_ => return,
126-
};
123+
let std_result_enum =
124+
match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() {
125+
PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e,
126+
_ => return,
127+
};
127128

128129
let std_result_type = std_result_enum.ty(db);
129130

130131
fn enum_from_type(ty: &Ty) -> Option<Enum> {
131132
match ty {
132-
Ty::Apply(t) => {
133-
match t.ctor {
134-
TypeCtor::Adt(AdtDef::Enum(e)) => Some(e),
135-
_ => None,
136-
}
137-
}
138-
_ => None
133+
Ty::Apply(t) => match t.ctor {
134+
TypeCtor::Adt(AdtDef::Enum(e)) => Some(e),
135+
_ => None,
136+
},
137+
_ => None,
139138
}
140139
}
141140

crates/ra_ide_api/src/diagnostics.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ mod tests {
217217
}
218218

219219
fn check_apply_diagnostic_fix_for_target_file(target_file: &str, fixture: &str, after: &str) {
220-
let (analysis, file_id, target_file_contents) = fixture_with_target_file(fixture, target_file);
220+
let (analysis, file_id, target_file_contents) =
221+
fixture_with_target_file(fixture, target_file);
221222
let diagnostic = analysis.diagnostics(file_id).unwrap().pop().unwrap();
222223
let mut fix = diagnostic.fix.unwrap();
223224
let edit = fix.source_file_edits.pop().unwrap().edit;
@@ -267,9 +268,9 @@ mod tests {
267268
pub enum Result<T, E> { Ok(T), Err(E) }
268269
}
269270
"#;
270-
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
271-
// it strips empty lines and leading whitespace. The important part of this test is that the final
272-
// `x / y` expr is now wrapped in `Ok(..)`
271+
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
272+
// it strips empty lines and leading whitespace. The important part of this test is that the final
273+
// `x / y` expr is now wrapped in `Ok(..)`
273274
let after = r#"use std::{string::String, result::Result::{self, Ok, Err}};
274275
fn div(x: i32, y: i32) -> Result<i32, String> {
275276
if y == 0 {
@@ -299,9 +300,9 @@ fn div(x: i32, y: i32) -> Result<i32, String> {
299300
pub enum Result<T, E> { Ok(T), Err(E) }
300301
}
301302
"#;
302-
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
303-
// it strips empty lines and leading whitespace. The important part of this test is that the final
304-
// expr is now wrapped in `Ok(..)`
303+
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
304+
// it strips empty lines and leading whitespace. The important part of this test is that the final
305+
// expr is now wrapped in `Ok(..)`
305306
let after = r#"use std::result::Result::{self, Ok, Err};
306307
fn div<T>(x: T) -> Result<T, i32> {
307308
if x == 0 {
@@ -336,9 +337,9 @@ fn div<T>(x: T) -> Result<T, i32> {
336337
pub enum Result<T, E> { Ok(T), Err(E) }
337338
}
338339
"#;
339-
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
340-
// it strips empty lines and leading whitespace. The important part of this test is that the final
341-
// `x / y` expr is now wrapped in `Ok(..)`
340+
// The formatting here is a bit odd due to how the parse_fixture function works in test_utils -
341+
// it strips empty lines and leading whitespace. The important part of this test is that the final
342+
// `x / y` expr is now wrapped in `Ok(..)`
342343
let after = r#"use std::{string::String, result::Result::{self, Ok, Err}};
343344
type MyResult<T> = Result<T, String>;
344345
fn div(x: i32, y: i32) -> MyResult<i32> {

0 commit comments

Comments
 (0)