internal: Flatten Definition::ModuleDef variant

This commit is contained in:
Lukas Wirth
2021-11-10 22:02:50 +01:00
parent f724c84e7d
commit 7776aad166
32 changed files with 709 additions and 702 deletions

View File

@@ -1,6 +1,6 @@
use rustc_hash::{FxHashMap, FxHashSet};
use hir::{HasSource, HirDisplay, Module, ModuleDef, Semantics, TypeInfo};
use hir::{HasSource, HirDisplay, Module, Semantics, TypeInfo};
use ide_db::helpers::FamousDefs;
use ide_db::{
base_db::FileId,
@@ -482,9 +482,8 @@ fn fn_arg_name(sema: &Semantics<RootDatabase>, arg_expr: &ast::Expr) -> String {
ast::Expr::CastExpr(cast_expr) => Some(fn_arg_name(sema, &cast_expr.expr()?)),
expr => {
let name_ref = expr.syntax().descendants().filter_map(ast::NameRef::cast).last()?;
if let Some(NameRefClass::Definition(Definition::ModuleDef(
ModuleDef::Const(_) | ModuleDef::Static(_),
))) = NameRefClass::classify(sema, &name_ref)
if let Some(NameRefClass::Definition(Definition::Const(_) | Definition::Static(_))) =
NameRefClass::classify(sema, &name_ref)
{
return Some(name_ref.to_string().to_lowercase());
};