mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
remove Cancelable from Module API, part 2
This commit is contained in:
parent
ca52cf1ecd
commit
c159e414b4
7 changed files with 28 additions and 33 deletions
|
@ -99,16 +99,16 @@ impl db::RootDatabase {
|
|||
|
||||
impl db::RootDatabase {
|
||||
/// Returns `Vec` for the same reason as `parent_module`
|
||||
pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> {
|
||||
pub(crate) fn crate_for(&self, file_id: FileId) -> Vec<CrateId> {
|
||||
let module = match source_binder::module_from_file_id(self, file_id) {
|
||||
Some(it) => it,
|
||||
None => return Ok(Vec::new()),
|
||||
None => return Vec::new(),
|
||||
};
|
||||
let krate = match module.krate(self)? {
|
||||
let krate = match module.krate(self) {
|
||||
Some(it) => it,
|
||||
None => return Ok(Vec::new()),
|
||||
None => return Vec::new(),
|
||||
};
|
||||
Ok(vec![krate.crate_id()])
|
||||
vec![krate.crate_id()]
|
||||
}
|
||||
pub(crate) fn find_all_refs(
|
||||
&self,
|
||||
|
|
|
@ -419,7 +419,7 @@ impl Analysis {
|
|||
|
||||
/// Returns crates this file belongs too.
|
||||
pub fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> {
|
||||
self.with_db(|db| db.crate_for(file_id))?
|
||||
self.with_db(|db| db.crate_for(file_id))
|
||||
}
|
||||
|
||||
/// Returns the root file of the given crate.
|
||||
|
|
|
@ -80,7 +80,6 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Opt
|
|||
// FIXME: thread cancellation instead of `.ok`ing
|
||||
let path = module
|
||||
.path_to_root(db)
|
||||
.ok()?
|
||||
.into_iter()
|
||||
.rev()
|
||||
.filter_map(|it| it.name(db))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue