From ec51867a5374715165c5e3e76a8e2fb7044bbfd6 Mon Sep 17 00:00:00 2001 From: Ben S Date: Thu, 12 Feb 2015 22:33:01 +0000 Subject: [PATCH] Upgrade to latest Rust - Update package versions - locale::default -> locale::english - Argument handling changes --- Cargo.lock | 34 +++++++++++++++++----------------- Cargo.toml | 2 +- src/file.rs | 2 +- src/main.rs | 8 ++------ src/output/details.rs | 8 ++++---- 5 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 49afb6d..360d828 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,11 @@ name = "exa" version = "0.1.0" dependencies = [ - "ansi_term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "datetime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "datetime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "locale 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "locale 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "natord 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "pad 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -29,10 +29,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "datetime" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "locale 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "locale 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "pad 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "regex_macros 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -45,7 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getopts" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -57,7 +57,7 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -68,13 +68,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libssh2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -91,7 +91,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -105,7 +105,7 @@ dependencies = [ [[package]] name = "locale" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -130,12 +130,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -150,7 +150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8ba4ced..5575c89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = [ "ogham@bsago.me" ] name = "exa" [dependencies] -ansi_term = "0.4.5" +ansi_term = "0.4.6" datetime = "0.1.3" #datetime_macros = "0.1.2" getopts = "0.2.1" diff --git a/src/file.rs b/src/file.rs index 3401f46..3d42625 100644 --- a/src/file.rs +++ b/src/file.rs @@ -292,7 +292,7 @@ impl<'a> File<'a> { match result { Standalone(bytes) => Cell::paint(Green.bold(), &*bytes.to_string()), Prefixed(prefix, n) => { - let number = if n < 10f64 { locale.format_float(n, 1, false) } else { locale.format_int(n as isize) }; + let number = if n < 10f64 { locale.format_float(n, 1) } else { locale.format_int(n as isize) }; let symbol = prefix.symbol(); Cell { diff --git a/src/main.rs b/src/main.rs index 6bddbc0..0745c0b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -#![feature(collections, core, env, io, libc, os, path, plugin, std_misc)] +#![feature(collections, core, env, io, libc, path, plugin, std_misc)] extern crate ansi_term; extern crate datetime; @@ -138,7 +138,7 @@ impl<'a> Exa<'a> { } fn main() { - let args = args(); + let args: Vec = env::args().collect(); match Options::getopts(args.tail()) { Ok((options, paths)) => { @@ -153,7 +153,3 @@ fn main() { }, }; } - -fn args() -> Vec { - env::args().map(|arg| arg.to_string_lossy().into_owned()).collect() -} diff --git a/src/output/details.rs b/src/output/details.rs index 93dd4c5..a48b9c3 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -115,15 +115,15 @@ pub struct UserLocale { impl UserLocale { pub fn new() -> UserLocale { UserLocale { - time: locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::default()), - numeric: locale::Numeric::load_user_locale().unwrap_or_else(|_| locale::Numeric::default()), + time: locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::english()), + numeric: locale::Numeric::load_user_locale().unwrap_or_else(|_| locale::Numeric::english()), } } pub fn default() -> UserLocale { UserLocale { - time: locale::Time::default(), - numeric: locale::Numeric::default(), + time: locale::Time::english(), + numeric: locale::Numeric::english(), } } }