remove Cancelable from Module API

This commit is contained in:
Aleksey Kladov 2019-01-15 18:26:29 +03:00
parent 91feed736f
commit ca52cf1ecd
6 changed files with 18 additions and 22 deletions

View file

@ -20,7 +20,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
}
let module_scope = module.scope(ctx.db)?;
let (file_id, _) = module.definition_source(ctx.db)?;
let (file_id, _) = module.definition_source(ctx.db);
module_scope
.entries()
.filter(|(_name, res)| {

View file

@ -73,9 +73,9 @@ impl NavigationTarget {
db: &RootDatabase,
module: hir::Module,
) -> Cancelable<NavigationTarget> {
let (file_id, source) = module.definition_source(db)?;
let (file_id, source) = module.definition_source(db);
let name = module
.name(db)?
.name(db)
.map(|it| it.to_string().into())
.unwrap_or_default();
let res = match source {
@ -94,10 +94,10 @@ impl NavigationTarget {
module: hir::Module,
) -> Cancelable<NavigationTarget> {
let name = module
.name(db)?
.name(db)
.map(|it| it.to_string().into())
.unwrap_or_default();
if let Some((file_id, source)) = module.declaration_source(db)? {
if let Some((file_id, source)) = module.declaration_source(db) {
return Ok(NavigationTarget::from_syntax(
file_id,
name,

View file

@ -83,8 +83,7 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Opt
.ok()?
.into_iter()
.rev()
.filter_map(|it| it.name(db).ok())
.filter_map(|it| it)
.filter_map(|it| it.name(db))
.join("::");
Some(Runnable {
range,