From 12e3b4c70b5ef23b2fdfc197296d483680e125f9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 Feb 2019 14:49:43 +0300 Subject: reformat the world --- crates/ra_hir/src/ids.rs | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'crates/ra_hir/src/ids.rs') diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 95678bf70..ea13c1196 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -169,11 +169,7 @@ impl Hash for ItemLoc { impl Clone for ItemLoc { fn clone(&self) -> ItemLoc { - ItemLoc { - module: self.module, - raw: self.raw, - _ty: PhantomData, - } + ItemLoc { module: self.module, raw: self.raw, _ty: PhantomData } } } @@ -186,11 +182,7 @@ pub(crate) struct LocationCtx { impl<'a, DB: PersistentHirDatabase> LocationCtx<&'a DB> { pub(crate) fn new(db: &'a DB, module: Module, file_id: HirFileId) -> LocationCtx<&'a DB> { - LocationCtx { - db, - module, - file_id, - } + LocationCtx { db, module, file_id } } pub(crate) fn to_def(self, ast: &N) -> DEF where @@ -205,15 +197,9 @@ pub(crate) trait AstItemDef: ArenaId + Clone { fn interner(interner: &HirInterner) -> &LocationIntener, Self>; fn from_ast(ctx: LocationCtx<&impl PersistentHirDatabase>, ast: &N) -> Self { let items = ctx.db.file_items(ctx.file_id); - let raw = SourceItemId { - file_id: ctx.file_id, - item_id: items.id_of(ctx.file_id, ast.syntax()), - }; - let loc = ItemLoc { - module: ctx.module, - raw, - _ty: PhantomData, - }; + let raw = + SourceItemId { file_id: ctx.file_id, item_id: items.id_of(ctx.file_id, ast.syntax()) }; + let loc = ItemLoc { module: ctx.module, raw, _ty: PhantomData }; Self::interner(ctx.db.as_ref()).loc2id(&loc) } @@ -221,9 +207,8 @@ pub(crate) trait AstItemDef: ArenaId + Clone { let int = Self::interner(db.as_ref()); let loc = int.id2loc(self); let syntax = db.file_item(loc.raw); - let ast = N::cast(&syntax) - .unwrap_or_else(|| panic!("invalid ItemLoc: {:?}", loc.raw)) - .to_owned(); + let ast = + N::cast(&syntax).unwrap_or_else(|| panic!("invalid ItemLoc: {:?}", loc.raw)).to_owned(); (loc.raw.file_id, ast) } fn module(self, db: &impl HirDatabase) -> Module { @@ -317,10 +302,7 @@ pub struct SourceFileItems { impl SourceFileItems { pub(crate) fn new(file_id: HirFileId, source_file: &SourceFile) -> SourceFileItems { - let mut res = SourceFileItems { - file_id, - arena: Arena::default(), - }; + let mut res = SourceFileItems { file_id, arena: Arena::default() }; res.init(source_file); res } -- cgit v1.2.3