From 43ccbf4360271d5da2fd3688a04b34c66357e0b6 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 18 Jan 2021 21:41:13 +0100 Subject: Remove unused ReferenceSearchResult functions --- crates/ide/src/references.rs | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 6999dacee..e8737dcfa 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -14,7 +14,6 @@ pub(crate) mod rename; use either::Either; use hir::Semantics; use ide_db::{ - base_db::FileId, defs::{Definition, NameClass, NameRefClass}, search::{FileReference, ReferenceAccess, ReferenceKind, SearchScope, UsageSearchResult}, RootDatabase, @@ -35,14 +34,14 @@ pub struct ReferenceSearchResult { #[derive(Debug, Clone)] pub struct Declaration { - pub nav: NavigationTarget, - pub kind: ReferenceKind, - pub access: Option, + nav: NavigationTarget, + kind: ReferenceKind, + access: Option, } impl ReferenceSearchResult { - pub fn references(&self) -> &UsageSearchResult { - &self.references + pub fn references(self) -> UsageSearchResult { + self.references } pub fn references_with_declaration(mut self) -> UsageSearchResult { @@ -55,24 +54,6 @@ impl ReferenceSearchResult { self.references.references.entry(file_id).or_default().push(decl_ref); self.references } - - /// Total number of references - /// At least 1 since all valid references should - /// Have a declaration - pub fn len(&self) -> usize { - self.references.len() + 1 - } -} - -// allow turning ReferenceSearchResult into an iterator -// over References -impl IntoIterator for ReferenceSearchResult { - type Item = (FileId, Vec); - type IntoIter = std::collections::hash_map::IntoIter>; - - fn into_iter(self) -> Self::IntoIter { - self.references_with_declaration().into_iter() - } } pub(crate) fn find_all_refs( -- cgit v1.2.3