mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
cargo format
This commit is contained in:
parent
456e72c4e4
commit
4f6f3933ec
2 changed files with 23 additions and 23 deletions
|
@ -12,7 +12,7 @@ use crate::{
|
|||
name,
|
||||
path::{PathKind, PathSegment},
|
||||
ty::{InferenceResult, Ty, TypeCtor},
|
||||
Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution
|
||||
Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution,
|
||||
};
|
||||
use ra_syntax::ast;
|
||||
|
||||
|
@ -116,11 +116,12 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
PathSegment { name: name::STD, args_and_bindings: None },
|
||||
PathSegment { name: name::RESULT_MOD, args_and_bindings: None },
|
||||
PathSegment { name: name::RESULT_TYPE, args_and_bindings: None },
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
let resolver = self.func.resolver(db);
|
||||
let std_result_enum = match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() {
|
||||
let std_result_enum =
|
||||
match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() {
|
||||
PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e,
|
||||
_ => return,
|
||||
};
|
||||
|
@ -129,13 +130,11 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
|
||||
fn enum_from_type(ty: &Ty) -> Option<Enum> {
|
||||
match ty {
|
||||
Ty::Apply(t) => {
|
||||
match t.ctor {
|
||||
Ty::Apply(t) => match t.ctor {
|
||||
TypeCtor::Adt(AdtDef::Enum(e)) => Some(e),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,8 @@ mod tests {
|
|||
}
|
||||
|
||||
fn check_apply_diagnostic_fix_for_target_file(target_file: &str, fixture: &str, after: &str) {
|
||||
let (analysis, file_id, target_file_contents) = fixture_with_target_file(fixture, target_file);
|
||||
let (analysis, file_id, target_file_contents) =
|
||||
fixture_with_target_file(fixture, target_file);
|
||||
let diagnostic = analysis.diagnostics(file_id).unwrap().pop().unwrap();
|
||||
let mut fix = diagnostic.fix.unwrap();
|
||||
let edit = fix.source_file_edits.pop().unwrap().edit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue