diff options
| author | Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> | 2025-05-15 13:18:30 +0900 |
|---|---|---|
| committer | Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> | 2025-05-15 13:18:30 +0900 |
| commit | 5adbda4ee5d3013cf9e9a9479268fc8e17d24c40 (patch) | |
| tree | 1994a9192047620ac5a23a0d8bbefd6ad3442782 | |
| parent | 6274d461cf3005ff1e22afa77c1a96090f63b40f (diff) | |
| download | rust-5adbda4ee5d3013cf9e9a9479268fc8e17d24c40.tar.gz rust-5adbda4ee5d3013cf9e9a9479268fc8e17d24c40.zip | |
rename fn name take_path to any
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
3 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics.rs b/src/tools/rust-analyzer/crates/hir/src/semantics.rs index 7ee72614e22..caa6700de9f 100644 --- a/src/tools/rust-analyzer/crates/hir/src/semantics.rs +++ b/src/tools/rust-analyzer/crates/hir/src/semantics.rs @@ -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) } } diff --git a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs index 610770d0f31..ea21546f9d7 100644 --- a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs +++ b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs @@ -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) diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_unused_imports.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_unused_imports.rs index fb96882ed42..dff9a660cf5 100644 --- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_unused_imports.rs +++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/remove_unused_imports.rs @@ -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; } |
