From 26d18be9af43a8f04838e015b091a787c517f61b Mon Sep 17 00:00:00 2001 From: Sam Rijs Date: Sat, 17 Feb 2018 09:31:38 +1100 Subject: [PATCH] upgrade from ordermap to indexmap --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 2 +- src/engine/machines/crawler.rs | 8 ++++---- src/main.rs | 2 +- src/models/crates.rs | 14 +++++++------- src/parsers/manifest.rs | 14 +++++++------- src/server/views/html/status.rs | 4 ++-- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a21cc5..f36b6e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,6 +217,14 @@ dependencies = [ "tokio-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "iovec" version = "0.1.2" @@ -470,14 +478,6 @@ dependencies = [ "unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ordermap" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "percent-encoding" version = "1.0.1" @@ -679,10 +679,10 @@ dependencies = [ "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "maud 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ordermap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "sass-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -957,6 +957,7 @@ dependencies = [ "checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37" "checksum hyper 0.11.18 (registry+https://github.com/rust-lang/crates.io-index)" = "c4f9b276c87e3fc1902a8bdfcce264c3f7c8a1c35e5e0c946062739f55026664" "checksum hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c81fa95203e2a6087242c38691a0210f23e9f3f8f944350bd676522132e2985" +"checksum indexmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7164c96d6e18ccc3ce43f3dedac996c21a220670a106c275b96ad92110401362" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -988,7 +989,6 @@ dependencies = [ "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" "checksum openssl-sys 0.9.25 (registry+https://github.com/rust-lang/crates.io-index)" = "93b3cbfaccf11969aea8c2041bfafc43c81666c1ce673476e19395c92cc77bf4" "checksum ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58d25b6c0e47b20d05226d288ff434940296e7e2f8b877975da32f862152241f" -"checksum ordermap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88fc9d511a8e8d3adc7ba9f4b8f9683a2eface9c14b652ad77f975c4f95c787b" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" diff --git a/Cargo.toml b/Cargo.toml index 62c1976..f5a6800 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,10 @@ failure = "0.1.1" futures = "0.1.18" hyper = "0.11.15" hyper-tls = "0.1.2" +indexmap = { version = "0.4.1", features = ["serde-1"] } lazy_static = "1.0.0" lru-cache = "0.1.1" maud = "0.17.2" -ordermap = { version = "0.4.0", features = ["serde-1"] } relative-path = { version = "0.3.7", features = ["serde"] } route-recognizer = "0.1.12" semver = { version = "0.9.0", features = ["serde"] } diff --git a/src/engine/machines/crawler.rs b/src/engine/machines/crawler.rs index f6e08bf..ac6bfae 100644 --- a/src/engine/machines/crawler.rs +++ b/src/engine/machines/crawler.rs @@ -2,13 +2,13 @@ use std::collections::HashMap; use failure::Error; use relative_path::RelativePathBuf; -use ordermap::map::OrderMap; +use indexmap::IndexMap; use ::parsers::manifest::parse_manifest_toml; use ::models::crates::{CrateDep, CrateDeps, CrateName, CrateManifest}; pub struct ManifestCrawlerOutput { - pub crates: OrderMap + pub crates: IndexMap } pub struct ManifestCrawlerStepOutput { @@ -17,14 +17,14 @@ pub struct ManifestCrawlerStepOutput { pub struct ManifestCrawler { manifests: HashMap, - leaf_crates: OrderMap + leaf_crates: IndexMap } impl ManifestCrawler { pub fn new() -> ManifestCrawler { ManifestCrawler { manifests: HashMap::new(), - leaf_crates: OrderMap::new() + leaf_crates: IndexMap::new() } } diff --git a/src/main.rs b/src/main.rs index 84fe8d3..dea0fa1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,10 +8,10 @@ extern crate badge; #[macro_use] extern crate futures; extern crate hyper; extern crate hyper_tls; +extern crate indexmap; #[macro_use] extern crate lazy_static; extern crate lru_cache; extern crate maud; -extern crate ordermap; extern crate relative_path; extern crate route_recognizer; extern crate semver; diff --git a/src/models/crates.rs b/src/models/crates.rs index c72c7fd..e499cda 100644 --- a/src/models/crates.rs +++ b/src/models/crates.rs @@ -2,7 +2,7 @@ use std::borrow::Borrow; use std::str::FromStr; use failure::Error; -use ordermap::OrderMap; +use indexmap::IndexMap; use relative_path::RelativePathBuf; use semver::{Version, VersionReq}; @@ -84,9 +84,9 @@ impl CrateDep { #[derive(Clone, Debug, Default)] pub struct CrateDeps { - pub main: OrderMap, - pub dev: OrderMap, - pub build: OrderMap + pub main: IndexMap, + pub dev: IndexMap, + pub build: IndexMap } #[derive(Debug)] @@ -112,9 +112,9 @@ impl AnalyzedDependency { #[derive(Debug)] pub struct AnalyzedDependencies { - pub main: OrderMap, - pub dev: OrderMap, - pub build: OrderMap + pub main: IndexMap, + pub dev: IndexMap, + pub build: IndexMap } impl AnalyzedDependencies { diff --git a/src/parsers/manifest.rs b/src/parsers/manifest.rs index c3a7b24..ab2e390 100644 --- a/src/parsers/manifest.rs +++ b/src/parsers/manifest.rs @@ -1,5 +1,5 @@ use failure::Error; -use ordermap::OrderMap; +use indexmap::IndexMap; use relative_path::RelativePathBuf; use semver::VersionReq; use toml; @@ -38,13 +38,13 @@ struct CargoToml { #[serde(default)] workspace: Option, #[serde(default)] - dependencies: OrderMap, + dependencies: IndexMap, #[serde(rename = "dev-dependencies")] #[serde(default)] - dev_dependencies: OrderMap, + dev_dependencies: IndexMap, #[serde(rename = "build-dependencies")] #[serde(default)] - build_dependencies: OrderMap + build_dependencies: IndexMap } fn convert_dependency(cargo_dep: (String, CargoTomlDependency)) -> Option> { @@ -86,11 +86,11 @@ pub fn parse_manifest_toml(input: &str) -> Result { let crate_name = package.name.parse::()?; let dependencies = cargo_toml.dependencies - .into_iter().filter_map(convert_dependency).collect::, _>>()?; + .into_iter().filter_map(convert_dependency).collect::, _>>()?; let dev_dependencies = cargo_toml.dev_dependencies - .into_iter().filter_map(convert_dependency).collect::, _>>()?; + .into_iter().filter_map(convert_dependency).collect::, _>>()?; let build_dependencies = cargo_toml.build_dependencies - .into_iter().filter_map(convert_dependency).collect::, _>>()?; + .into_iter().filter_map(convert_dependency).collect::, _>>()?; let deps = CrateDeps { main: dependencies, diff --git a/src/server/views/html/status.rs b/src/server/views/html/status.rs index fc4aa6a..2342cc4 100644 --- a/src/server/views/html/status.rs +++ b/src/server/views/html/status.rs @@ -1,6 +1,6 @@ use hyper::Response; use maud::{Markup, html}; -use ordermap::OrderMap; +use indexmap::IndexMap; use ::engine::AnalyzeDependenciesOutcome; use ::models::crates::{CrateName, AnalyzedDependency, AnalyzedDependencies}; @@ -34,7 +34,7 @@ fn dependency_tables(crate_name: CrateName, deps: AnalyzedDependencies) -> Marku } } -fn dependency_table(title: &str, deps: OrderMap) -> Markup { +fn dependency_table(title: &str, deps: IndexMap) -> Markup { let count_total = deps.len(); let count_outdated = deps.iter().filter(|&(_, dep)| dep.is_outdated()).count();