mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
internal: remove potentially slow method
This commit is contained in:
parent
3c5827cc18
commit
7ec8434674
3 changed files with 7 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
|||
use either::Either;
|
||||
use hir::{known, Callable, HirDisplay, Semantics};
|
||||
use hir::{known, Callable, HasVisibility, HirDisplay, Semantics};
|
||||
use ide_db::helpers::FamousDefs;
|
||||
use ide_db::RootDatabase;
|
||||
use stdx::to_lower_snake_case;
|
||||
|
@ -221,7 +221,11 @@ fn hint_iterator(
|
|||
let iter_mod = famous_defs.core_iter()?;
|
||||
|
||||
// Assert that this struct comes from `core::iter`.
|
||||
iter_mod.visibility_of(db, &strukt.into()).filter(|&vis| vis == hir::Visibility::Public)?;
|
||||
if !(strukt.visibility(db) == hir::Visibility::Public
|
||||
&& strukt.module(db).path_to_root(db).contains(&iter_mod))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
if ty.impls_trait(db, iter_trait, &[]) {
|
||||
let assoc_type_item = iter_trait.items(db).into_iter().find_map(|item| match item {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue