Use more of FxHash*

This commit is contained in:
Laurențiu Nicola
2020-06-29 18:07:52 +03:00
parent 82ce5792ab
commit 95d67ec401
6 changed files with 25 additions and 15 deletions

View File

@@ -1,7 +1,11 @@
//! Fully type-check project and print various stats, like the number of type
//! errors.
use std::{collections::HashSet, path::Path, time::Instant};
use std::{path::Path, time::Instant};
use itertools::Itertools;
use rand::{seq::SliceRandom, thread_rng};
use rustc_hash::FxHashSet;
use hir::{
db::{AstDatabase, DefDatabase, HirDatabase},
@@ -9,10 +13,8 @@ use hir::{
};
use hir_def::FunctionId;
use hir_ty::{Ty, TypeWalk};
use itertools::Itertools;
use ra_db::SourceDatabaseExt;
use ra_syntax::AstNode;
use rand::{seq::SliceRandom, thread_rng};
use stdx::format_to;
use crate::cli::{load_cargo::load_cargo, progress_report::ProgressReport, Result, Verbosity};
@@ -33,7 +35,7 @@ pub fn analysis_stats(
println!("Database loaded {:?}", db_load_time.elapsed());
let analysis_time = Instant::now();
let mut num_crates = 0;
let mut visited_modules = HashSet::new();
let mut visited_modules = FxHashSet::default();
let mut visit_queue = Vec::new();
let mut krates = Crate::all(db);

View File

@@ -1,11 +1,14 @@
//! Analyze all modules in a project for diagnostics. Exits with a non-zero status
//! code if any errors are found.
use std::path::Path;
use anyhow::anyhow;
use rustc_hash::FxHashSet;
use hir::Crate;
use ra_db::SourceDatabaseExt;
use ra_ide::Severity;
use std::{collections::HashSet, path::Path};
use crate::cli::{load_cargo::load_cargo, Result};
@@ -20,7 +23,7 @@ pub fn diagnostics(
let analysis = host.analysis();
let mut found_error = false;
let mut visited_files = HashSet::new();
let mut visited_files = FxHashSet::default();
let mut work = Vec::new();
let krates = Crate::all(db);