mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
fix reaper in workspace
This commit is contained in:
parent
76418d9b82
commit
4efb617ae9
1 changed files with 5 additions and 5 deletions
|
|
@ -14,8 +14,8 @@ use std::{
|
||||||
};
|
};
|
||||||
use syn::{visit_mut::VisitMut, ImplItem, Item};
|
use syn::{visit_mut::VisitMut, ImplItem, Item};
|
||||||
|
|
||||||
fn file_for_suggestion(suggestion: &Suggestion) -> &str {
|
fn file_for_suggestion(suggestion: &Suggestion) -> &Path {
|
||||||
&suggestion.solutions[0].replacements[0].snippet.file_name
|
Path::new(&suggestion.solutions[0].replacements[0].snippet.file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
const PASS_NAME: &str = "delete-unused-functions";
|
const PASS_NAME: &str = "delete-unused-functions";
|
||||||
|
|
@ -59,13 +59,13 @@ impl Minimizer {
|
||||||
|
|
||||||
fn apply_unused_imports(
|
fn apply_unused_imports(
|
||||||
&mut self,
|
&mut self,
|
||||||
suggestions: &HashMap<&str, Vec<&Suggestion>>,
|
suggestions: &HashMap<&Path, Vec<&Suggestion>>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
for (file, suggestions) in suggestions {
|
for (sugg_file, suggestions) in suggestions {
|
||||||
let Some(file) = self
|
let Some(file) = self
|
||||||
.files
|
.files
|
||||||
.iter()
|
.iter()
|
||||||
.find(|source| source.path == Path::new(file)) else {
|
.find(|source| source.path.ends_with(sugg_file) || sugg_file.ends_with(&source.path)) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue