Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultRuby committed Jan 24, 2024
1 parent 22e6dcd commit 7232a54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/ast_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,17 @@ fn process_typescript_file(path: String, actual_imports: &mut HashMap<String, Im
if !&import_declaration.type_only {
match &import_declaration.src.raw {
Some(src) => {
let line: usize;
match source_map.lookup_line(module.span.lo) {
Ok(source) => line = source.line,
Err(_) => {
line = 0;
}
}
let line: usize =
match source_map.lookup_line(module.span.lo) {
Ok(source) => source.line,
Err(_) => 0,
};
let name =
utils::remove_first_and_last_chars(src.to_string());
let actual_import = ImportStatement {
name: name.clone(),
file: path.clone(),
line: line.clone(),
line,
};
file_imports.insert(name, actual_import);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ pub fn crop_dep_only(dependency: String) -> String {
Ordering::Equal => String::from(split_dep[0]),
Ordering::Greater => {
if organization_dependency.is_match(split_dep[0]) {
return split_dep[0].to_owned() + "/" + split_dep[1];
split_dep[0].to_owned() + "/" + split_dep[1]
} else {
return split_dep[0].to_owned();
split_dep[0].to_owned()
}
}
Ordering::Less => String::new(),
}
}

pub fn filtered_and_cropped_deps(dependencies: &mut HashMap<String, ImportStatement>) -> () {
pub fn filtered_and_cropped_deps(dependencies: &mut HashMap<String, ImportStatement>) {
let mut keys_to_remove = Vec::new();
let mut items_to_add: HashMap<String, ImportStatement> = HashMap::new();

Expand Down

0 comments on commit 7232a54

Please sign in to comment.