From 4f6f3933ec04df55a39368d591c91cf81d980237 Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Sun, 11 Aug 2019 15:04:08 +0100 Subject: cargo format --- crates/ra_hir/src/expr/validation.rs | 25 ++++++++++++------------- crates/ra_ide_api/src/diagnostics.rs | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 339a7b848..f0da3d169 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -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,26 +116,25 @@ 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() { - PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e, - _ => return, - }; + 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, + }; let std_result_type = std_result_enum.ty(db); fn enum_from_type(ty: &Ty) -> Option { match ty { - Ty::Apply(t) => { - match t.ctor { - TypeCtor::Adt(AdtDef::Enum(e)) => Some(e), - _ => None, - } - } - _ => None + Ty::Apply(t) => match t.ctor { + TypeCtor::Adt(AdtDef::Enum(e)) => Some(e), + _ => None, + }, + _ => None, } } diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 9841fbdf3..0b9bb5a66 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -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; @@ -267,9 +268,9 @@ mod tests { pub enum Result { Ok(T), Err(E) } } "#; -// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - -// it strips empty lines and leading whitespace. The important part of this test is that the final -// `x / y` expr is now wrapped in `Ok(..)` + // The formatting here is a bit odd due to how the parse_fixture function works in test_utils - + // it strips empty lines and leading whitespace. The important part of this test is that the final + // `x / y` expr is now wrapped in `Ok(..)` let after = r#"use std::{string::String, result::Result::{self, Ok, Err}}; fn div(x: i32, y: i32) -> Result { if y == 0 { @@ -299,9 +300,9 @@ fn div(x: i32, y: i32) -> Result { pub enum Result { Ok(T), Err(E) } } "#; -// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - -// it strips empty lines and leading whitespace. The important part of this test is that the final -// expr is now wrapped in `Ok(..)` + // The formatting here is a bit odd due to how the parse_fixture function works in test_utils - + // it strips empty lines and leading whitespace. The important part of this test is that the final + // expr is now wrapped in `Ok(..)` let after = r#"use std::result::Result::{self, Ok, Err}; fn div(x: T) -> Result { if x == 0 { @@ -336,9 +337,9 @@ fn div(x: T) -> Result { pub enum Result { Ok(T), Err(E) } } "#; -// The formatting here is a bit odd due to how the parse_fixture function works in test_utils - -// it strips empty lines and leading whitespace. The important part of this test is that the final -// `x / y` expr is now wrapped in `Ok(..)` + // The formatting here is a bit odd due to how the parse_fixture function works in test_utils - + // it strips empty lines and leading whitespace. The important part of this test is that the final + // `x / y` expr is now wrapped in `Ok(..)` let after = r#"use std::{string::String, result::Result::{self, Ok, Err}}; type MyResult = Result; fn div(x: i32, y: i32) -> MyResult { -- cgit v1.2.3