8000 Significantly reduce amount of dependencies by bjorn3 · Pull Request #12 · tweedegolf/cargo-minify · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 0 additions & 275 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ name = "useless"
[dependencies]
cargo_metadata = "0.17"
diff = "0.1.13"
git2 = "0.17"
glob-match = "0.2.1"
gumdrop = "0.8"
multimap = "0.9"
nu-ansi-term = "0.49.0"
proc-macro2 = { version = "1.0.66", features = ["span-locations"] }
syn = { version = "2.0.28", features = ["full"] }
thiserror = "1.0.44"
25 changes: 15 additions & 10 deletions src/cauterize.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
collections::HashMap,
ops::Range,
path::{Path, PathBuf},
};
Expand Down Expand Up @@ -132,7 +133,11 @@ fn diagnostics_to_ranges<'a>(
}

/// Handles (inline) module content
fn handle_mod_diagnostic(block: &syn::ItemMod, kind: &UnusedDiagnosticKind, ident: &str) -> Option<proc_macro2::Span> {
fn handle_mod_diagnostic(
block: &syn::ItemMod,
kind: &UnusedDiagnosticKind,
ident: &str,
) -> Option<proc_macro2::Span> {
use syn::Item;
use UnusedDiagnosticKind::*;

Expand Down Expand Up @@ -224,15 +229,15 @@ fn process_files<Iter: IntoIterator<Item = UnusedDiagnostic>>(
pub fn process_diagnostics(
diagnostics: impl IntoIterator<Item = UnusedDiagnostic>,
) -> impl Iterator<Item = Change> {
process_files(
diagnostics
.into_iter()
.map(|diagnostic| {
let path = PathBuf::from(&diagnostic.span.file_name);
(path, diagnostic)
})
.collect::<multimap::MultiMap<_, _>>(),
)
let mut diagnostics_by_path: HashMap<PathBuf, Vec<UnusedDiagnostic>> = HashMap::new();
for diagnostic in diagnostics {
let path = PathBuf::from(&diagnostic.span.file_name);
diagnostics_by_path
.entry(path)
.or_default()
.push(diagnostic);
}
process_files(diagnostics_by_path)
}

/// Create a table of byte locations of newline symbols,
Expand Down
Loading
0