remove Cancelable from static&const API

This commit is contained in:
Aleksey Kladov 2019-01-15 18:45:01 +03:00
parent 9446be2999
commit 9dd4099d93
2 changed files with 12 additions and 15 deletions

View file

@ -333,8 +333,8 @@ impl Const {
Const { def_id }
}
pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::ConstDef>)> {
Ok(def_id_to_ast(db, self.def_id))
pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::ConstDef>) {
def_id_to_ast(db, self.def_id)
}
}
@ -348,11 +348,8 @@ impl Static {
Static { def_id }
}
pub fn source(
&self,
db: &impl HirDatabase,
) -> Cancelable<(HirFileId, TreeArc<ast::StaticDef>)> {
Ok(def_id_to_ast(db, self.def_id))
pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::StaticDef>) {
def_id_to_ast(db, self.def_id)
}
}
@ -366,8 +363,8 @@ impl Trait {
Trait { def_id }
}
pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TraitDef>)> {
Ok(def_id_to_ast(db, self.def_id))
pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TraitDef>) {
def_id_to_ast(db, self.def_id)
}
}
@ -381,7 +378,7 @@ impl Type {
Type { def_id }
}
pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TypeDef>)> {
Ok(def_id_to_ast(db, self.def_id))
pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) {
def_id_to_ast(db, self.def_id)
}
}

View file

@ -128,19 +128,19 @@ impl NavigationTarget {
NavigationTarget::from_named(file_id.original_file(db), &*node)
}
Def::Trait(f) => {
let (file_id, node) = f.source(db)?;
let (file_id, node) = f.source(db);
NavigationTarget::from_named(file_id.original_file(db), &*node)
}
Def::Type(f) => {
let (file_id, node) = f.source(db)?;
let (file_id, node) = f.source(db);
NavigationTarget::from_named(file_id.original_file(db), &*node)
}
Def::Static(f) => {
let (file_id, node) = f.source(db)?;
let (file_id, node) = f.source(db);
NavigationTarget::from_named(file_id.original_file(db), &*node)
}
Def::Const(f) => {
let (file_id, node) = f.source(db)?;
let (file_id, node) = f.source(db);
NavigationTarget::from_named(file_id.original_file(db), &*node)
}
Def::Module(m) => NavigationTarget::from_module(db, m)?,