From 9adbf18481f3433dce7bd87277b9f2dc21e4c7a8 Mon Sep 17 00:00:00 2001 From: joshmc Date: Sun, 15 Nov 2020 08:55:13 +0000 Subject: [PATCH] ISSUE-16 - Rename utils module to mapping Signed-off-by: joshmc --- cargo-geiger/src/format/display.rs | 2 +- cargo-geiger/src/format/pattern.rs | 2 +- cargo-geiger/src/format/table.rs | 2 +- cargo-geiger/src/format/table/handle_text_tree_line.rs | 2 +- cargo-geiger/src/graph.rs | 2 +- cargo-geiger/src/main.rs | 4 ++-- cargo-geiger/src/{utils.rs => mapping.rs} | 0 cargo-geiger/src/{utils => mapping}/core.rs | 2 +- cargo-geiger/src/{utils => mapping}/krates.rs | 2 +- cargo-geiger/src/{utils => mapping}/metadata.rs | 0 cargo-geiger/src/scan.rs | 2 +- cargo-geiger/src/scan/default.rs | 2 +- cargo-geiger/src/scan/default/table.rs | 2 +- cargo-geiger/src/scan/find.rs | 4 +++- cargo-geiger/src/scan/forbid.rs | 2 +- cargo-geiger/src/scan/forbid/table.rs | 6 +++--- cargo-geiger/src/tree/traversal.rs | 2 +- cargo-geiger/src/tree/traversal/dependency_kind.rs | 2 +- cargo-geiger/src/tree/traversal/dependency_node.rs | 2 +- 19 files changed, 22 insertions(+), 20 deletions(-) rename cargo-geiger/src/{utils.rs => mapping.rs} (100%) rename cargo-geiger/src/{utils => mapping}/core.rs (98%) rename cargo-geiger/src/{utils => mapping}/krates.rs (99%) rename cargo-geiger/src/{utils => mapping}/metadata.rs (100%) diff --git a/cargo-geiger/src/format/display.rs b/cargo-geiger/src/format/display.rs index e2bd7fed..23f356f3 100644 --- a/cargo-geiger/src/format/display.rs +++ b/cargo-geiger/src/format/display.rs @@ -1,7 +1,7 @@ use crate::format::pattern::Pattern; use crate::format::Chunk; -use crate::utils::{ +use crate::mapping::{ CargoMetadataParameters, GetPackageNameFromCargoMetadataPackageId, GetPackageVersionFromCargoMetadataPackageId, }; diff --git a/cargo-geiger/src/format/pattern.rs b/cargo-geiger/src/format/pattern.rs index 104aa286..f29572bf 100644 --- a/cargo-geiger/src/format/pattern.rs +++ b/cargo-geiger/src/format/pattern.rs @@ -3,7 +3,7 @@ use crate::format::{Chunk, RawChunk}; use super::display::Display; -use crate::utils::CargoMetadataParameters; +use crate::mapping::CargoMetadataParameters; use cargo::core::manifest::ManifestMetadata; use std::error::Error; diff --git a/cargo-geiger/src/format/table.rs b/cargo-geiger/src/format/table.rs index caf2cbcf..acff4800 100644 --- a/cargo-geiger/src/format/table.rs +++ b/cargo-geiger/src/format/table.rs @@ -13,7 +13,7 @@ use handle_text_tree_line::{ }; use total_package_counts::TotalPackageCounts; -use crate::utils::CargoMetadataParameters; +use crate::mapping::CargoMetadataParameters; use cargo::core::package::PackageSet; use cargo_geiger_serde::{Count, CounterBlock}; use std::collections::HashSet; diff --git a/cargo-geiger/src/format/table/handle_text_tree_line.rs b/cargo-geiger/src/format/table/handle_text_tree_line.rs index 91e958df..850815a6 100644 --- a/cargo-geiger/src/format/table/handle_text_tree_line.rs +++ b/cargo-geiger/src/format/table/handle_text_tree_line.rs @@ -1,8 +1,8 @@ use crate::format::emoji_symbols::EmojiSymbols; use crate::format::print_config::colorize; use crate::format::{get_kind_group_name, CrateDetectionStatus, SymbolKind}; +use crate::mapping::{CargoMetadataParameters, ToPackage}; use crate::scan::unsafe_stats; -use crate::utils::{CargoMetadataParameters, ToPackage}; use super::total_package_counts::TotalPackageCounts; use super::TableParameters; diff --git a/cargo-geiger/src/graph.rs b/cargo-geiger/src/graph.rs index 1f4fadf7..d33e50c8 100644 --- a/cargo-geiger/src/graph.rs +++ b/cargo-geiger/src/graph.rs @@ -1,6 +1,6 @@ use crate::args::{Args, DepsArgs, TargetArgs}; use crate::cli::get_cfgs; -use crate::utils::{ +use crate::mapping::{ CargoMetadataParameters, DepsNotReplaced, MatchesIgnoringSource, Replacement, }; diff --git a/cargo-geiger/src/main.rs b/cargo-geiger/src/main.rs index 02060f88..22e7ea0b 100644 --- a/cargo-geiger/src/main.rs +++ b/cargo-geiger/src/main.rs @@ -14,9 +14,9 @@ mod args; mod cli; mod format; mod graph; +mod mapping; mod scan; mod tree; -mod utils; use crate::args::{Args, HELP}; use crate::cli::{ @@ -25,7 +25,7 @@ use crate::cli::{ use crate::graph::build_graph; use crate::scan::scan; -use crate::utils::{ +use crate::mapping::{ CargoMetadataParameters, ToCargoMetadataPackage, ToCargoMetadataPackageId, }; use cargo::core::shell::{ColorChoice, Shell}; diff --git a/cargo-geiger/src/utils.rs b/cargo-geiger/src/mapping.rs similarity index 100% rename from cargo-geiger/src/utils.rs rename to cargo-geiger/src/mapping.rs diff --git a/cargo-geiger/src/utils/core.rs b/cargo-geiger/src/mapping/core.rs similarity index 98% rename from cargo-geiger/src/utils/core.rs rename to cargo-geiger/src/mapping/core.rs index 4c10255a..62710c8f 100644 --- a/cargo-geiger/src/utils/core.rs +++ b/cargo-geiger/src/mapping/core.rs @@ -1,6 +1,6 @@ use super::ToCargoMetadataDependencyKind; -use crate::utils::{ToCargoMetadataPackage, ToCargoMetadataPackageId}; +use crate::mapping::{ToCargoMetadataPackage, ToCargoMetadataPackageId}; use cargo::core::dependency::DepKind; use cargo::core::{Package, PackageId}; diff --git a/cargo-geiger/src/utils/krates.rs b/cargo-geiger/src/mapping/krates.rs similarity index 99% rename from cargo-geiger/src/utils/krates.rs rename to cargo-geiger/src/mapping/krates.rs index 13cf99db..df360fb5 100644 --- a/cargo-geiger/src/utils/krates.rs +++ b/cargo-geiger/src/mapping/krates.rs @@ -1,4 +1,4 @@ -use crate::utils::{ +use crate::mapping::{ GetManifestMetadataFromCargoMetadataPackageId, GetPackageNameFromCargoMetadataPackageId, GetPackageVersionFromCargoMetadataPackageId, ToPackage, diff --git a/cargo-geiger/src/utils/metadata.rs b/cargo-geiger/src/mapping/metadata.rs similarity index 100% rename from cargo-geiger/src/utils/metadata.rs rename to cargo-geiger/src/mapping/metadata.rs diff --git a/cargo-geiger/src/scan.rs b/cargo-geiger/src/scan.rs index 75c7009f..3d20f739 100644 --- a/cargo-geiger/src/scan.rs +++ b/cargo-geiger/src/scan.rs @@ -6,7 +6,7 @@ mod rs_file; use crate::args::Args; use crate::format::print_config::PrintConfig; use crate::graph::Graph; -use crate::utils::{ +use crate::mapping::{ CargoMetadataParameters, ToCargoCoreDepKind, ToCargoGeigerPackageId, }; diff --git a/cargo-geiger/src/scan/default.rs b/cargo-geiger/src/scan/default.rs index 97ba67b7..4351cef0 100644 --- a/cargo-geiger/src/scan/default.rs +++ b/cargo-geiger/src/scan/default.rs @@ -3,8 +3,8 @@ mod table; use crate::args::FeaturesArgs; use crate::format::print_config::OutputFormat; use crate::graph::Graph; +use crate::mapping::CargoMetadataParameters; use crate::scan::rs_file::resolve_rs_file_deps; -use crate::utils::CargoMetadataParameters; use super::find::find_unsafe; use super::{ diff --git a/cargo-geiger/src/scan/default/table.rs b/cargo-geiger/src/scan/default/table.rs index 59804f19..de594f4e 100644 --- a/cargo-geiger/src/scan/default/table.rs +++ b/cargo-geiger/src/scan/default/table.rs @@ -12,7 +12,7 @@ use super::super::{ }; use super::scan; -use crate::utils::CargoMetadataParameters; +use crate::mapping::CargoMetadataParameters; use cargo::core::shell::Verbosity; use cargo::core::{PackageSet, Workspace}; use cargo::{CliError, CliResult}; diff --git a/cargo-geiger/src/scan/find.rs b/cargo-geiger/src/scan/find.rs index a3faa35a..90d9f14a 100644 --- a/cargo-geiger/src/scan/find.rs +++ b/cargo-geiger/src/scan/find.rs @@ -1,10 +1,12 @@ use crate::format::print_config::PrintConfig; +use crate::mapping::{ + CargoMetadataParameters, GetRoot, ToCargoMetadataPackage, +}; use crate::scan::rs_file::{ into_is_entry_point_and_path_buf, into_rs_code_file, into_target_kind, is_file_with_ext, RsFile, RsFileMetricsWrapper, }; use crate::scan::PackageMetrics; -use crate::utils::{CargoMetadataParameters, GetRoot, ToCargoMetadataPackage}; use super::{GeigerContext, ScanMode}; diff --git a/cargo-geiger/src/scan/forbid.rs b/cargo-geiger/src/scan/forbid.rs index 240955c0..e4ad22ee 100644 --- a/cargo-geiger/src/scan/forbid.rs +++ b/cargo-geiger/src/scan/forbid.rs @@ -8,7 +8,7 @@ use super::{package_metrics, ScanMode, ScanParameters}; use table::scan_forbid_to_table; -use crate::utils::CargoMetadataParameters; +use crate::mapping::CargoMetadataParameters; use cargo::core::PackageSet; use cargo::{CliResult, Config}; use cargo_geiger_serde::{QuickReportEntry, QuickSafetyReport}; diff --git a/cargo-geiger/src/scan/forbid/table.rs b/cargo-geiger/src/scan/forbid/table.rs index 1e1f59cb..8ae8761b 100644 --- a/cargo-geiger/src/scan/forbid/table.rs +++ b/cargo-geiger/src/scan/forbid/table.rs @@ -3,11 +3,11 @@ use crate::format::pattern::Pattern; use crate::format::print_config::PrintConfig; use crate::format::{get_kind_group_name, SymbolKind}; use crate::graph::Graph; -use crate::tree::traversal::walk_dependency_tree; -use crate::tree::TextTreeLine; -use crate::utils::{ +use crate::mapping::{ CargoMetadataParameters, GetManifestMetadataFromCargoMetadataPackageId, }; +use crate::tree::traversal::walk_dependency_tree; +use crate::tree::TextTreeLine; use super::super::find::find_unsafe; use super::super::ScanMode; diff --git a/cargo-geiger/src/tree/traversal.rs b/cargo-geiger/src/tree/traversal.rs index d3fded15..b9b7021c 100644 --- a/cargo-geiger/src/tree/traversal.rs +++ b/cargo-geiger/src/tree/traversal.rs @@ -3,8 +3,8 @@ mod dependency_node; use crate::format::print_config::PrintConfig; use crate::graph::Graph; +use crate::mapping::CargoMetadataParameters; use crate::tree::TextTreeLine; -use crate::utils::CargoMetadataParameters; use super::construct_tree_vines_string; use dependency_kind::walk_dependency_kind; diff --git a/cargo-geiger/src/tree/traversal/dependency_kind.rs b/cargo-geiger/src/tree/traversal/dependency_kind.rs index fa40191a..1916b51c 100644 --- a/cargo-geiger/src/tree/traversal/dependency_kind.rs +++ b/cargo-geiger/src/tree/traversal/dependency_kind.rs @@ -4,7 +4,7 @@ use crate::tree::{get_tree_symbols, TextTreeLine, TreeSymbols}; use super::dependency_node::walk_dependency_node; -use crate::utils::CargoMetadataParameters; +use crate::mapping::CargoMetadataParameters; use cargo::core::dependency::DepKind; use cargo::core::PackageSet; use std::iter::Peekable; diff --git a/cargo-geiger/src/tree/traversal/dependency_node.rs b/cargo-geiger/src/tree/traversal/dependency_node.rs index 4eb8c016..926ac7b9 100644 --- a/cargo-geiger/src/tree/traversal/dependency_node.rs +++ b/cargo-geiger/src/tree/traversal/dependency_node.rs @@ -1,8 +1,8 @@ use crate::format::print_config::PrintConfig; use crate::graph::Graph; +use crate::mapping::{CargoMetadataParameters, ToCargoCoreDepKind}; use crate::tree::traversal::WalkDependencyParameters; use crate::tree::TextTreeLine; -use crate::utils::{CargoMetadataParameters, ToCargoCoreDepKind}; use super::construct_tree_vines_string; use super::walk_dependency_kind;