Skip to content

Commit d941912

Browse files
authored
Remove some clippy warnings (#204)
1 parent 9ff4bce commit d941912

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/c_macro.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ fn is_identifier_starter(c: u8) -> bool {
1414
}
1515

1616
#[inline(always)]
17-
fn is_macro(mac: &str, macros: &HashSet<String>) -> bool {
17+
fn is_macro<S: ::std::hash::BuildHasher>(mac: &str, macros: &HashSet<String, S>) -> bool {
1818
macros.contains(mac) || PREDEFINED_MACROS.contains(mac)
1919
}
2020

21-
pub fn replace(code: &[u8], macros: &HashSet<String>) -> Option<Vec<u8>> {
21+
pub fn replace<S: ::std::hash::BuildHasher>(
22+
code: &[u8],
23+
macros: &HashSet<String, S>,
24+
) -> Option<Vec<u8>> {
2225
let mut new_code = Vec::with_capacity(code.len());
2326
let mut code_start = 0;
2427
let mut k_start = 0;

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::implicit_hasher)]
2-
31
#[macro_use]
42
extern crate lazy_static;
53
#[macro_use]

src/preproc.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ impl PreprocFile {
3434
}
3535
}
3636

37-
pub fn get_macros(file: &PathBuf, files: &HashMap<PathBuf, PreprocFile>) -> HashSet<String> {
37+
pub fn get_macros<S: ::std::hash::BuildHasher>(
38+
file: &PathBuf,
39+
files: &HashMap<PathBuf, PreprocFile, S>,
40+
) -> HashSet<String> {
3841
let mut macros = HashSet::new();
3942
if let Some(pf) = files.get(file) {
4043
for m in pf.macros.iter() {
@@ -51,9 +54,9 @@ pub fn get_macros(file: &PathBuf, files: &HashMap<PathBuf, PreprocFile>) -> Hash
5154
macros
5255
}
5356

54-
pub fn fix_includes(
55-
files: &mut HashMap<PathBuf, PreprocFile>,
56-
all_files: &HashMap<String, Vec<PathBuf>>,
57+
pub fn fix_includes<S: ::std::hash::BuildHasher>(
58+
files: &mut HashMap<PathBuf, PreprocFile, S>,
59+
all_files: &HashMap<String, Vec<PathBuf>, S>,
5760
) {
5861
let mut nodes: HashMap<PathBuf, NodeIndex> = HashMap::new();
5962
// Since we'll remove strong connected components we need to have a stable graph

src/tools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ pub fn get_paths_dist(path1: &PathBuf, path2: &PathBuf) -> Option<usize> {
185185
None
186186
}
187187

188-
pub fn guess_file(
188+
pub fn guess_file<S: ::std::hash::BuildHasher>(
189189
current_path: &PathBuf,
190190
include_path: &str,
191-
all_files: &HashMap<String, Vec<PathBuf>>,
191+
all_files: &HashMap<String, Vec<PathBuf>, S>,
192192
) -> Vec<PathBuf> {
193193
//let rpath = include_path.clone();
194194
let include_path = if include_path.starts_with("mozilla/") {

0 commit comments

Comments
 (0)