From 76849744384cdb89570d1d29a8b9e0881f6030e4 Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 11:24:02 +0200 Subject: [PATCH 01/10] Remove `failure` from the `polonius` bin --- Cargo.lock | 1 - Cargo.toml | 1 - src/cli.rs | 6 +++--- src/lib.rs | 1 - src/main.rs | 4 ++-- src/test.rs | 12 ++++++------ 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b567024d2a9..bac88667386 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -419,7 +419,6 @@ dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "polonius-engine 0.10.0", diff --git a/Cargo.toml b/Cargo.toml index e50ccaec1b8..d1f26355b28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ polonius-parser = {version = "0.3.0", path = "polonius-parser" } [dependencies] env_logger = "0.5" -failure = "0.1.1" rustc-hash = "1.0.0" structopt = "0.2.8" clap = "2.31.2" diff --git a/src/cli.rs b/src/cli.rs index 56d3f9f9806..91c8eff2ea5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -3,9 +3,9 @@ use crate::dump::Output; use crate::facts::AllFacts; use crate::intern; use crate::tab_delim; -use failure::Error; use log::error; use polonius_engine::Algorithm; +use std::error::Error; use std::path::Path; use std::time::{Duration, Instant}; use structopt::StructOpt; @@ -56,7 +56,7 @@ macro_rules! attempt { }; } -pub fn main(opt: Opt) -> Result<(), Error> { +pub fn main(opt: Opt) -> Result<(), Box> { let output_directory = opt .output_directory .as_ref() @@ -69,7 +69,7 @@ pub fn main(opt: Opt) -> Result<(), Error> { for facts_dir in &opt.fact_dirs { let tables = &mut intern::InternerTables::new(); - let result: Result<(Duration, AllFacts, Output), Error> = attempt! { + let result: Result<(Duration, AllFacts, Output), Box> = attempt! { let verbose = opt.verbose; let all_facts = tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir))?; diff --git a/src/lib.rs b/src/lib.rs index dcf81bc78ee..525ad9eba37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ extern crate clap; -extern crate failure; extern crate polonius_engine; extern crate rustc_hash; extern crate structopt; diff --git a/src/main.rs b/src/main.rs index 003dfbb1468..47f629ed1cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,11 @@ extern crate env_logger; -extern crate failure; extern crate polonius; extern crate structopt; use structopt::StructOpt; +use std::error::Error; -pub fn main() -> Result<(), failure::Error> { +pub fn main() -> Result<(), Box> { env_logger::init(); let opt = polonius::cli::Opt::from_args(); polonius::cli::main(opt) diff --git a/src/test.rs b/src/test.rs index 7a7364d5084..567de2c1610 100644 --- a/src/test.rs +++ b/src/test.rs @@ -6,10 +6,10 @@ use crate::intern; use crate::program::parse_from_program; use crate::tab_delim; use crate::test_util::assert_equal; -use failure::Error; use polonius_engine::Algorithm; use rustc_hash::FxHashMap; use std::path::Path; +use std::error::Error; fn test_facts(all_facts: &AllFacts, algorithms: &[Algorithm]) { let naive = Output::compute(all_facts, Algorithm::Naive, true); @@ -55,7 +55,7 @@ fn test_facts(all_facts: &AllFacts, algorithms: &[Algorithm]) { assert_equal(&naive.errors, &opt.errors); } -fn test_fn(dir_name: &str, fn_name: &str, algorithm: Algorithm) -> Result<(), Error> { +fn test_fn(dir_name: &str, fn_name: &str, algorithm: Algorithm) -> Result<(), Box> { let facts_dir = Path::new(env!("CARGO_MANIFEST_DIR")) .join("inputs") .join(dir_name) @@ -74,7 +74,7 @@ macro_rules! tests { use super::*; #[test] - fn datafrog_opt() -> Result<(), Error> { + fn datafrog_opt() -> Result<(), Box> { test_fn($dir, $fn, Algorithm::DatafrogOpt) } } @@ -90,7 +90,7 @@ tests! { } #[test] -fn test_insensitive_errors() -> Result<(), Error> { +fn test_insensitive_errors() -> Result<(), Box> { let facts_dir = Path::new(env!("CARGO_MANIFEST_DIR")) .join("inputs") .join("issue-47680") @@ -110,7 +110,7 @@ fn test_insensitive_errors() -> Result<(), Error> { } #[test] -fn test_sensitive_passes_issue_47680() -> Result<(), Error> { +fn test_sensitive_passes_issue_47680() -> Result<(), Box> { let facts_dir = Path::new(env!("CARGO_MANIFEST_DIR")) .join("inputs") .join("issue-47680") @@ -125,7 +125,7 @@ fn test_sensitive_passes_issue_47680() -> Result<(), Error> { } #[test] -fn no_subset_symmetries_exist() -> Result<(), Error> { +fn no_subset_symmetries_exist() -> Result<(), Box> { let facts_dir = Path::new(env!("CARGO_MANIFEST_DIR")) .join("inputs") .join("issue-47680") From 9f03e377f3f49eda431eb45e82cddfe11464249c Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 12:14:43 +0200 Subject: [PATCH 02/10] Remove unused `assert_cli` from the `polonius` bin dev-dependencies --- Cargo.lock | 128 ----------------------------------------------------- Cargo.toml | 1 - 2 files changed, 129 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bac88667386..9dc8b5406b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,19 +24,6 @@ dependencies = [ "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "assert_cli" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "colored 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "atty" version = "0.2.11" @@ -47,27 +34,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "backtrace" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bit-set" version = "0.5.0" @@ -115,11 +81,6 @@ name = "byteorder" version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cc" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cfg-if" version = "0.1.6" @@ -147,14 +108,6 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "colored" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "datafrog" version = "2.0.0" @@ -165,11 +118,6 @@ name = "diff" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "difference" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "digest" version = "0.8.0" @@ -215,31 +163,6 @@ dependencies = [ "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "environment" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "failure" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -296,11 +219,6 @@ dependencies = [ "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "itoa" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "kernel32-sys" version = "0.2.2" @@ -415,7 +333,6 @@ dependencies = [ name = "polonius" version = "0.5.0" dependencies = [ - "assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -529,11 +446,6 @@ dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rustc-demangle" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rustc-hash" version = "1.0.1" @@ -542,11 +454,6 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ryu" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "serde" version = "1.0.80" @@ -562,16 +469,6 @@ dependencies = [ "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "serde_json" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sha2" version = "0.8.0" @@ -654,17 +551,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "synstructure" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "term" version = "0.4.6" @@ -811,10 +697,7 @@ dependencies = [ "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" -"checksum assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a29ab7c0ed62970beb0534d637a8688842506d0ff9157de83286dacd065c8149" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a" "checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -822,22 +705,16 @@ dependencies = [ "checksum block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc4358306e344bf9775d0197fd00d2603e5afb0771bb353538630f022068ea3" "checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum colored 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc0a60679001b62fb628c4da80e574b9645ab4646056d7c9018885efffe45533" "checksum datafrog 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77ba99c0ba9573918469fac8d6ec440cf6620af901c940e00003edf1b7caa32c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" -"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" "checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" -"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" @@ -846,7 +723,6 @@ dependencies = [ "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572" "checksum lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33b27d8490dbe1f9704b0088d61e8d46edc10d5673a8829836c6ded26a9912c7" @@ -871,12 +747,9 @@ dependencies = [ "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" -"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" @@ -886,7 +759,6 @@ dependencies = [ "checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" "checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" diff --git a/Cargo.toml b/Cargo.toml index d1f26355b28..1c74b31860c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ keywords = ["compiler", "borrowck", "datalog"] edition = "2018" [dev-dependencies] -assert_cli = "0.6" diff = "0.1.0" polonius-parser = {version = "0.3.0", path = "polonius-parser" } From 4b1829d8ea73f1f5cc06e6093d14110fb470de90 Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 12:35:48 +0200 Subject: [PATCH 03/10] Switch from `clap` and `structopt` to `pico-args` in the `polonius` bin --- Cargo.lock | 91 +++---------------------------------- Cargo.toml | 3 +- src/cli.rs | 127 ++++++++++++++++++++++++++++++++++++++-------------- src/lib.rs | 2 - src/main.rs | 8 ++-- src/test.rs | 2 +- 6 files changed, 106 insertions(+), 127 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dc8b5406b6..4ccb5915ba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,14 +8,6 @@ dependencies = [ "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ascii-canvas" version = "1.0.0" @@ -86,20 +78,6 @@ name = "cfg-if" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "clap" -version = "2.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -195,14 +173,6 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "heck" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "humantime" version = "1.2.0" @@ -329,19 +299,23 @@ dependencies = [ "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pico-args" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "polonius" version = "0.5.0" dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "polonius-engine 0.10.0", "polonius-parser 0.3.0", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -521,26 +495,6 @@ name = "strsim" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "structopt" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "structopt-derive" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "syn" version = "0.15.22" @@ -578,14 +532,6 @@ dependencies = [ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "textwrap" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "thread_local" version = "0.3.6" @@ -604,16 +550,6 @@ name = "ucd-util" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-segmentation" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-width" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.1.0" @@ -632,11 +568,6 @@ name = "utf8-ranges" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "version_check" version = "0.1.5" @@ -695,7 +626,6 @@ dependencies = [ [metadata] "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a" @@ -706,7 +636,6 @@ dependencies = [ "checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum datafrog 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77ba99c0ba9573918469fac8d6ec440cf6620af901c940e00003edf1b7caa32c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" @@ -720,7 +649,6 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" -"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -736,6 +664,7 @@ dependencies = [ "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" "checksum phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "b539898d22d4273ded07f64a05737649dc69095d92cb87c7097ec68e3f150b93" +"checksum pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fce25154205cf4360b456fd7d48994afe20663b77e3bd3d0a353a2fccf7f22c" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" @@ -756,22 +685,16 @@ dependencies = [ "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" -"checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 1c74b31860c..b96b7ab30da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,9 @@ polonius-parser = {version = "0.3.0", path = "polonius-parser" } [dependencies] env_logger = "0.5" rustc-hash = "1.0.0" -structopt = "0.2.8" -clap = "2.31.2" polonius-engine = {version = "0.10.0", path = "polonius-engine" } log = "0.4" petgraph = "0.4.13" +pico-args = "0.2" [workspace] diff --git a/src/cli.rs b/src/cli.rs index 91c8eff2ea5..ebe14419416 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -4,49 +4,26 @@ use crate::facts::AllFacts; use crate::intern; use crate::tab_delim; use log::error; +use pico_args::Arguments; use polonius_engine::Algorithm; use std::error::Error; use std::path::Path; +use std::process::exit; use std::time::{Duration, Instant}; -use structopt::StructOpt; - -#[derive(StructOpt, Debug)] -#[structopt(name = "borrow-check")] -pub struct Opt { - #[structopt( - short = "a", - env = "POLONIUS_ALGORITHM", - default_value = "naive", - raw(possible_values = "&Algorithm::variants()", case_insensitive = "true") - )] + +const PKG_NAME: &'static str = env!("CARGO_PKG_NAME"); +const PKG_VERSION: &'static str = env!("CARGO_PKG_VERSION"); +const PKG_DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION"); + +#[derive(Debug)] +pub struct Options { algorithm: Algorithm, - #[structopt(long = "show-tuples", help = "Show output tuples on stdout")] show_tuples: bool, - #[structopt(long = "skip-timing", help = "Do not display timing results")] skip_timing: bool, - #[structopt( - short = "v", - long = "verbose", - help = "Show intermediate output tuples and not just errors" - )] verbose: bool, - #[structopt( - long = "graphviz_file", - help = "Generate a graphviz file to visualize the computation" - )] graphviz_file: Option, - #[structopt( - short = "o", - long = "output", - help = "Directory where to output resulting tuples" - )] output_directory: Option, - #[structopt(raw(required = "true"))] fact_dirs: Vec, - #[structopt( - long = "dump-liveness-graph", - help = "Generate a graphviz file to visualize the liveness information" - )] liveness_graph_file: Option, } @@ -56,7 +33,7 @@ macro_rules! attempt { }; } -pub fn main(opt: Opt) -> Result<(), Box> { +pub fn main(opt: Options) -> Result<(), Box> { let output_directory = opt .output_directory .as_ref() @@ -118,3 +95,87 @@ fn timed(op: impl FnOnce() -> T) -> (Duration, T) { let duration = start.elapsed(); (duration, output) } + +impl Options { + pub fn from_args() -> Result> { + let mut args = Arguments::from_env(); + + // 1) print optional information before exiting: help, version + let show_help = args.contains(["-h", "--help"]); + if show_help { + let variants: Vec<_> = Algorithm::variants() + .iter() + .map(|s| s.to_string()) + .collect(); + + println!( + r#"{name} {version} +{description} + +USAGE: + polonius [FLAGS] [OPTIONS] ... + +FLAGS: + -h, --help Prints help information + --show-tuples Show output tuples on stdout + --skip-timing Do not display timing results + -V, --version Prints version information + -v, --verbose Show intermediate output tuples and not just errors + +OPTIONS: + -a [default: Naive] + [possible values: {variants}] + --graphviz_file Generate a graphviz file to visualize the computation + --dump-liveness-graph Generate a graphviz file to visualize the liveness information + -o, --output Directory where to output resulting tuples + +ARGS: + ..."#, + name = PKG_NAME, + version = PKG_VERSION, + description = PKG_DESCRIPTION, + variants = variants.join(", ") + ); + exit(0); + } + + // print version if needed + if args.contains("-V") { + println!("{} {}", PKG_NAME, PKG_VERSION); + exit(0); + } + + // 2) parse args + // TODO: the error printed when `value_from_str` is called is terrible. + // The new unreleased version of pico_args (current: 0.1) will allow to get the error enum, and print what we need. + // Finish this when it's released ! + let options = Options { + algorithm: args.value_from_str("-a")?.unwrap_or(Algorithm::Naive), + show_tuples: args.contains("--show-tuples"), + skip_timing: args.contains("--skip-timing"), + verbose: args.contains(["-v", "--verbose"]), + graphviz_file: args.value_from_str("--graphviz_file")?, + output_directory: args + .value_from_str("-o")? + .or(args.value_from_str("--output")?), + liveness_graph_file: args.value_from_str("--dump-liveness-graph")?, + fact_dirs: args.free()?, + }; + + // 3) validate args: a fact directory is required + if options.fact_dirs.is_empty() { + println!( + r#"error: The following required arguments were not provided: + ... + +USAGE: + polonius ... -a + +For more information try --help"# + ); + exit(1); + } + + Ok(options) + } +} diff --git a/src/lib.rs b/src/lib.rs index 525ad9eba37..2b8765e2e0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ -extern crate clap; extern crate polonius_engine; extern crate rustc_hash; -extern crate structopt; mod dump; mod facts; diff --git a/src/main.rs b/src/main.rs index 47f629ed1cc..ea706f29ae5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,10 @@ extern crate env_logger; -extern crate polonius; -extern crate structopt; -use structopt::StructOpt; +use polonius::cli; use std::error::Error; pub fn main() -> Result<(), Box> { env_logger::init(); - let opt = polonius::cli::Opt::from_args(); - polonius::cli::main(opt) + let options = cli::Options::from_args()?; + cli::main(options) } diff --git a/src/test.rs b/src/test.rs index 567de2c1610..cbae1782aff 100644 --- a/src/test.rs +++ b/src/test.rs @@ -8,8 +8,8 @@ use crate::tab_delim; use crate::test_util::assert_equal; use polonius_engine::Algorithm; use rustc_hash::FxHashMap; -use std::path::Path; use std::error::Error; +use std::path::Path; fn test_facts(all_facts: &AllFacts, algorithms: &[Algorithm]) { let naive = Output::compute(all_facts, Algorithm::Naive, true); From 0aed05929c8c429c0517e479909c551757a3f6e6 Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 13:58:51 +0200 Subject: [PATCH 04/10] Remove `env_logger` from the `polonius` bin --- Cargo.lock | 57 ------------------------------------------------------ Cargo.toml | 1 - 2 files changed, 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ccb5915ba8..f236294eb0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,18 +129,6 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "env_logger" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -173,14 +161,6 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "humantime" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itertools" version = "0.8.0" @@ -309,7 +289,6 @@ name = "polonius" version = "0.5.0" dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -349,11 +328,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "quote" version = "0.6.10" @@ -514,14 +488,6 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termcolor" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "termion" version = "1.5.1" @@ -602,28 +568,11 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "winapi-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "wincolor" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [metadata] "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" @@ -643,13 +592,11 @@ dependencies = [ "checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" -"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" -"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572" @@ -667,7 +614,6 @@ dependencies = [ "checksum pico-args 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fce25154205cf4360b456fd7d48994afe20663b77e3bd3d0a353a2fccf7f22c" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" @@ -687,7 +633,6 @@ dependencies = [ "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" @@ -701,6 +646,4 @@ dependencies = [ "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" diff --git a/Cargo.toml b/Cargo.toml index b96b7ab30da..0d6345eb79e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ diff = "0.1.0" polonius-parser = {version = "0.3.0", path = "polonius-parser" } [dependencies] -env_logger = "0.5" rustc-hash = "1.0.0" polonius-engine = {version = "0.10.0", path = "polonius-engine" } log = "0.4" From cca5db225f5584a015a9c032fbb0000e4a22511a Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 14:12:36 +0200 Subject: [PATCH 05/10] update `datafrog` dependency to avoid the rustdoc error --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f236294eb0c..489d3bc5572 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "datafrog" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -301,7 +301,7 @@ dependencies = [ name = "polonius-engine" version = "0.10.0" dependencies = [ - "datafrog 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "datafrog 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -586,7 +586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum datafrog 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77ba99c0ba9573918469fac8d6ec440cf6620af901c940e00003edf1b7caa32c" +"checksum datafrog 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" "checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" From 1979ab07e4568bdc3b78f1a5b74a5b9ecba4d647 Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 14:15:09 +0200 Subject: [PATCH 06/10] Improve `pico_args` error display --- src/cli.rs | 139 ++++++++++++++++++++++++++++++++++------------------ src/main.rs | 17 ++++--- 2 files changed, 101 insertions(+), 55 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index ebe14419416..fc6561ddd65 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -4,11 +4,13 @@ use crate::facts::AllFacts; use crate::intern; use crate::tab_delim; use log::error; -use pico_args::Arguments; +use pico_args as pico; use polonius_engine::Algorithm; -use std::error::Error; +use std::error; +use std::fmt; use std::path::Path; use std::process::exit; +use std::str::FromStr; use std::time::{Duration, Instant}; const PKG_NAME: &'static str = env!("CARGO_PKG_NAME"); @@ -27,13 +29,24 @@ pub struct Options { liveness_graph_file: Option, } +#[derive(Debug)] +pub struct Error(String); + +impl error::Error for Error {} + +impl fmt::Display for Error { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt.write_str(&self.0) + } +} + macro_rules! attempt { ($($tokens:tt)*) => { (|| Ok({ $($tokens)* }))() }; } -pub fn main(opt: Options) -> Result<(), Box> { +pub fn main(opt: Options) -> Result<(), Error> { let output_directory = opt .output_directory .as_ref() @@ -46,10 +59,10 @@ pub fn main(opt: Options) -> Result<(), Box> { for facts_dir in &opt.fact_dirs { let tables = &mut intern::InternerTables::new(); - let result: Result<(Duration, AllFacts, Output), Box> = attempt! { + let result: Result<(Duration, AllFacts, Output), Error> = attempt! { let verbose = opt.verbose; let all_facts = - tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir))?; + tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir)).map_err(|e|Error(e.to_string()))?; let algorithm = opt.algorithm; let graphviz_output = graphviz_file.is_some() || liveness_graph_file.is_some(); let (duration, output) = @@ -96,19 +109,19 @@ fn timed(op: impl FnOnce() -> T) -> (Duration, T) { (duration, output) } -impl Options { - pub fn from_args() -> Result> { - let mut args = Arguments::from_env(); +// Parses the provided CLI arguments into `Options` +pub fn options_from_args() -> Result { + let mut args = pico::Arguments::from_env(); - // 1) print optional information before exiting: help, version - let show_help = args.contains(["-h", "--help"]); - if show_help { - let variants: Vec<_> = Algorithm::variants() - .iter() - .map(|s| s.to_string()) - .collect(); + // 1) print optional information before exiting: help, version + let show_help = args.contains(["-h", "--help"]); + if show_help { + let variants: Vec<_> = Algorithm::variants() + .iter() + .map(|s| s.to_string()) + .collect(); - println!( + println!( r#"{name} {version} {description} @@ -136,46 +149,76 @@ ARGS: description = PKG_DESCRIPTION, variants = variants.join(", ") ); - exit(0); - } + exit(0); + } - // print version if needed - if args.contains("-V") { - println!("{} {}", PKG_NAME, PKG_VERSION); - exit(0); - } + // print version if needed + if args.contains("-V") { + println!("{} {}", PKG_NAME, PKG_VERSION); + exit(0); + } - // 2) parse args - // TODO: the error printed when `value_from_str` is called is terrible. - // The new unreleased version of pico_args (current: 0.1) will allow to get the error enum, and print what we need. - // Finish this when it's released ! - let options = Options { - algorithm: args.value_from_str("-a")?.unwrap_or(Algorithm::Naive), - show_tuples: args.contains("--show-tuples"), - skip_timing: args.contains("--skip-timing"), - verbose: args.contains(["-v", "--verbose"]), - graphviz_file: args.value_from_str("--graphviz_file")?, - output_directory: args - .value_from_str("-o")? - .or(args.value_from_str("--output")?), - liveness_graph_file: args.value_from_str("--dump-liveness-graph")?, - fact_dirs: args.free()?, - }; + // 2) parse args + let options = Options { + algorithm: arg_from_str(&mut args, "-a")?.unwrap_or(Algorithm::Naive), + show_tuples: args.contains("--show-tuples"), + skip_timing: args.contains("--skip-timing"), + verbose: args.contains(["-v", "--verbose"]), + graphviz_file: arg_from_str(&mut args, "--graphviz_file")?, + output_directory: arg_from_str(&mut args, "-o")?.or(arg_from_str(&mut args, "--output")?), + liveness_graph_file: arg_from_str(&mut args, "--dump-liveness-graph")?, + fact_dirs: args.free().map_err(readable_pico_error)?, + }; - // 3) validate args: a fact directory is required - if options.fact_dirs.is_empty() { - println!( - r#"error: The following required arguments were not provided: + // 3) validate args: a fact directory is required + if options.fact_dirs.is_empty() { + println!( + r#"error: The following required arguments were not provided: ... USAGE: polonius ... -a For more information try --help"# - ); - exit(1); - } - - Ok(options) + ); + exit(1); } + + Ok(options) +} + +// Read an argument from the CLI, parse it, but with a readable error message if it fails +pub fn arg_from_str(args: &mut pico::Arguments, key: &'static str) -> Result, Error> +where + T: FromStr, + ::Err: fmt::Display, +{ + args.value_from_str(key).map_err(|e| { + Error(format!( + "error parsing argument '{}': {}", + key, + readable_pico_error(e) + )) + }) +} + +// Make a pico_args error a bit more readable than just its `Debug` output +fn readable_pico_error(error: pico::Error) -> Error { + use pico::Error; + Error(match error { + Error::ArgumentParsingFailed { cause } => format!("failed to parse ({})", cause), + Error::Utf8ArgumentParsingFailed { value, cause } => { + format!("'{}' isn't a valid value ({})", value, cause) + } + Error::OptionWithoutAValue(_) => "missing value".to_string(), + Error::UnusedArgsLeft(left) => { + let plural = if left.len() > 1 { "were" } else { "was" }; + format!( + "error parsing arguments: {} {} not recognized", + left.join(", "), + plural + ) + } + Error::NonUtf8Argument => "not a valid utf8 value".to_string(), + }) } diff --git a/src/main.rs b/src/main.rs index ea706f29ae5..cd1aef70d08 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,13 @@ -extern crate env_logger; - use polonius::cli; -use std::error::Error; +use std::process::exit; -pub fn main() -> Result<(), Box> { - env_logger::init(); - let options = cli::Options::from_args()?; - cli::main(options) +fn main() -> Result<(), cli::Error> { + match cli::options_from_args() { + Ok(options) => cli::main(options), + Err(e) => { + // override default `Termination` error printing + eprintln!("{}\n\nFor more information try --help", e); + exit(1); + } + } } From f51773b9a72d254d627f7c7ccc35a20f1d6770a3 Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 14:33:42 +0200 Subject: [PATCH 07/10] `extern crate` is not necessary anymore --- src/lib.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2b8765e2e0f..3ca862b0837 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,3 @@ -extern crate polonius_engine; -extern crate rustc_hash; - mod dump; mod facts; mod intern; @@ -10,6 +7,3 @@ mod test; mod test_util; pub mod cli; - -extern crate log; -extern crate petgraph; From e27986211379b4555b1a7f4254544ccef291a3db Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 18:23:55 +0200 Subject: [PATCH 08/10] tweak unrecognized arguments error message --- src/cli.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index fc6561ddd65..4fa1a182292 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -212,12 +212,7 @@ fn readable_pico_error(error: pico::Error) -> Error { } Error::OptionWithoutAValue(_) => "missing value".to_string(), Error::UnusedArgsLeft(left) => { - let plural = if left.len() > 1 { "were" } else { "was" }; - format!( - "error parsing arguments: {} {} not recognized", - left.join(", "), - plural - ) + format!("error, unrecognized arguments: {}", left.join(", ")) } Error::NonUtf8Argument => "not a valid utf8 value".to_string(), }) From 8d6ecad416ea7bd2a3c132e3adb6c7d8c3a54d3b Mon Sep 17 00:00:00 2001 From: lqd Date: Thu, 19 Sep 2019 18:28:21 +0200 Subject: [PATCH 09/10] Fix `--graphviz_file` naming for consistency --- src/cli.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 4fa1a182292..bb055bd6112 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -138,9 +138,9 @@ FLAGS: OPTIONS: -a [default: Naive] [possible values: {variants}] - --graphviz_file Generate a graphviz file to visualize the computation - --dump-liveness-graph Generate a graphviz file to visualize the liveness information - -o, --output Directory where to output resulting tuples + --graphviz-file Generate a graphviz file to visualize the computation + --dump-liveness-graph Generate a graphviz file to visualize the liveness information + -o, --output Directory where to output resulting tuples ARGS: ..."#, @@ -164,7 +164,7 @@ ARGS: show_tuples: args.contains("--show-tuples"), skip_timing: args.contains("--skip-timing"), verbose: args.contains(["-v", "--verbose"]), - graphviz_file: arg_from_str(&mut args, "--graphviz_file")?, + graphviz_file: arg_from_str(&mut args, "--graphviz-file")?, output_directory: arg_from_str(&mut args, "-o")?.or(arg_from_str(&mut args, "--output")?), liveness_graph_file: arg_from_str(&mut args, "--dump-liveness-graph")?, fact_dirs: args.free().map_err(readable_pico_error)?, From 8f4bfb854092aaa7d67681b7c20f9c1bfed642a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81my=20Rakic?= Date: Thu, 19 Sep 2019 21:00:21 +0200 Subject: [PATCH 10/10] oh rustfmt ignored the code in macros maybe we should remove this one --- src/cli.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index bb055bd6112..50ad4ec0b9f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -61,8 +61,8 @@ pub fn main(opt: Options) -> Result<(), Error> { let result: Result<(Duration, AllFacts, Output), Error> = attempt! { let verbose = opt.verbose; - let all_facts = - tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir)).map_err(|e|Error(e.to_string()))?; + let all_facts = tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir)) + .map_err(|e| Error(e.to_string()))?; let algorithm = opt.algorithm; let graphviz_output = graphviz_file.is_some() || liveness_graph_file.is_some(); let (duration, output) =