Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests.rs')
-rw-r--r--crates/hir-ty/src/tests.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/hir-ty/src/tests.rs b/crates/hir-ty/src/tests.rs
index 9804910c87..5e159236f4 100644
--- a/crates/hir-ty/src/tests.rs
+++ b/crates/hir-ty/src/tests.rs
@@ -10,7 +10,7 @@ mod regression;
mod simple;
mod traits;
-use std::{collections::HashMap, env};
+use std::env;
use base_db::{FileRange, SourceDatabaseExt};
use expect_test::Expect;
@@ -25,6 +25,7 @@ use hir_def::{
};
use hir_expand::{db::ExpandDatabase, InFile};
use once_cell::race::OnceBool;
+use rustc_hash::FxHashMap;
use stdx::format_to;
use syntax::{
ast::{self, AstNode, HasName},
@@ -90,16 +91,16 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
let (db, files) = TestDB::with_many_files(ra_fixture);
let mut had_annotations = false;
- let mut mismatches = HashMap::new();
- let mut types = HashMap::new();
- let mut adjustments = HashMap::<_, Vec<_>>::new();
+ let mut mismatches = FxHashMap::default();
+ let mut types = FxHashMap::default();
+ let mut adjustments = FxHashMap::<_, Vec<_>>::default();
for (file_id, annotations) in db.extract_annotations() {
for (range, expected) in annotations {
let file_range = FileRange { file_id, range };
if only_types {
types.insert(file_range, expected);
} else if expected.starts_with("type: ") {
- types.insert(file_range, expected.trim_start_matches("type: ").to_string());
+ types.insert(file_range, expected.trim_start_matches("type: ").to_owned());
} else if expected.starts_with("expected") {
mismatches.insert(file_range, expected);
} else if expected.starts_with("adjustments:") {
@@ -109,7 +110,7 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
.trim_start_matches("adjustments:")
.trim()
.split(',')
- .map(|it| it.trim().to_string())
+ .map(|it| it.trim().to_owned())
.filter(|it| !it.is_empty())
.collect(),
);
@@ -330,7 +331,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
});
for (node, ty) in &types {
let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.value.clone()) {
- (self_param.name().unwrap().syntax().text_range(), "self".to_string())
+ (self_param.name().unwrap().syntax().text_range(), "self".to_owned())
} else {
(node.value.text_range(), node.value.text().to_string().replace('\n', " "))
};