mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
rename fn name take_path to any
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
30fe761685
commit
bf13549ab6
@ -118,7 +118,7 @@ impl PathResolutionPerNs {
|
||||
) -> Self {
|
||||
PathResolutionPerNs { type_ns, value_ns, macro_ns }
|
||||
}
|
||||
pub fn take_path(&self) -> Option<PathResolution> {
|
||||
pub fn any(&self) -> Option<PathResolution> {
|
||||
self.type_ns.or(self.value_ns).or(self.macro_ns)
|
||||
}
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ impl<'db> SourceAnalyzer<'db> {
|
||||
Some(&store),
|
||||
false,
|
||||
)
|
||||
.take_path()?;
|
||||
.any()?;
|
||||
let subst = (|| {
|
||||
let parent = parent()?;
|
||||
let ty = if let Some(expr) = ast::Expr::cast(parent.clone()) {
|
||||
@ -1556,7 +1556,7 @@ pub(crate) fn resolve_hir_path(
|
||||
hygiene: HygieneId,
|
||||
store: Option<&ExpressionStore>,
|
||||
) -> Option<PathResolution> {
|
||||
resolve_hir_path_(db, resolver, path, false, hygiene, store, false).take_path()
|
||||
resolve_hir_path_(db, resolver, path, false, hygiene, store, false).any()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -1677,7 +1677,7 @@ fn resolve_hir_path_(
|
||||
.unwrap_or_else(|| PathResolutionPerNs::new(None, values(), None))
|
||||
};
|
||||
|
||||
if res.take_path().is_some() {
|
||||
if res.any().is_some() {
|
||||
res
|
||||
} else if let Some(type_ns) = items() {
|
||||
PathResolutionPerNs::new(Some(type_ns), None, None)
|
||||
|
@ -81,7 +81,7 @@ pub(crate) fn remove_unused_imports(acc: &mut Assists, ctx: &AssistContext<'_>)
|
||||
|
||||
// Get the actual definition associated with this use item.
|
||||
let res = match ctx.sema.resolve_path_per_ns(&path) {
|
||||
Some(x) if x.take_path().is_some() => x,
|
||||
Some(x) if x.any().is_some() => x,
|
||||
Some(_) | None => {
|
||||
return None;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user