Browse Source

Upgrade to latest Rust

- Update package versions
- locale::default -> locale::english
- Argument handling changes
Ben S 11 năm trước cách đây
mục cha
commit
ec51867a53
5 tập tin đã thay đổi với 25 bổ sung29 xóa
  1. 17 17
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 1 1
      src/file.rs
  4. 2 6
      src/main.rs
  5. 4 4
      src/output/details.rs

+ 17 - 17
Cargo.lock

@@ -2,11 +2,11 @@
 name = "exa"
 name = "exa"
 version = "0.1.0"
 version = "0.1.0"
 dependencies = [
 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)",
  "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)",
  "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)",
  "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)",
  "pad 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -15,7 +15,7 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "ansi_term"
 name = "ansi_term"
-version = "0.4.5"
+version = "0.4.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "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]]
 [[package]]
 name = "datetime"
 name = "datetime"
-version = "0.1.3"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 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)",
  "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 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)",
  "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]]
 [[package]]
 name = "getopts"
 name = "getopts"
-version = "0.2.3"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "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]]
 [[package]]
 name = "libgit2-sys"
 name = "libgit2-sys"
-version = "0.1.12"
+version = "0.1.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "libssh2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "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]]
 [[package]]
@@ -91,7 +91,7 @@ version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "libz-sys 0.1.0 (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)",
+ "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)",
  "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 ]
 
 
@@ -105,7 +105,7 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "locale"
 name = "locale"
-version = "0.1.2"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 
 [[package]]
 [[package]]
@@ -130,12 +130,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 
 [[package]]
 [[package]]
 name = "openssl-sys"
 name = "openssl-sys"
-version = "0.3.3"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
 dependencies = [
  "gcc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "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]]
 [[package]]
@@ -150,7 +150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 
 [[package]]
 [[package]]
 name = "pkg-config"
 name = "pkg-config"
-version = "0.2.0"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 
 [[package]]
 [[package]]

+ 1 - 1
Cargo.toml

@@ -7,7 +7,7 @@ authors = [ "ogham@bsago.me" ]
 name = "exa"
 name = "exa"
 
 
 [dependencies]
 [dependencies]
-ansi_term = "0.4.5"
+ansi_term = "0.4.6"
 datetime = "0.1.3"
 datetime = "0.1.3"
 #datetime_macros = "0.1.2"
 #datetime_macros = "0.1.2"
 getopts = "0.2.1"
 getopts = "0.2.1"

+ 1 - 1
src/file.rs

@@ -292,7 +292,7 @@ impl<'a> File<'a> {
             match result {
             match result {
                 Standalone(bytes) => Cell::paint(Green.bold(), &*bytes.to_string()),
                 Standalone(bytes) => Cell::paint(Green.bold(), &*bytes.to_string()),
                 Prefixed(prefix, n) => {
                 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();
                     let symbol = prefix.symbol();
 
 
                     Cell {
                     Cell {

+ 2 - 6
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 ansi_term;
 extern crate datetime;
 extern crate datetime;
@@ -138,7 +138,7 @@ impl<'a> Exa<'a> {
 }
 }
 
 
 fn main() {
 fn main() {
-    let args = args();
+    let args: Vec<String> = env::args().collect();
 
 
     match Options::getopts(args.tail()) {
     match Options::getopts(args.tail()) {
         Ok((options, paths)) => {
         Ok((options, paths)) => {
@@ -153,7 +153,3 @@ fn main() {
         },
         },
     };
     };
 }
 }
-
-fn args() -> Vec<String> {
-    env::args().map(|arg| arg.to_string_lossy().into_owned()).collect()
-}

+ 4 - 4
src/output/details.rs

@@ -115,15 +115,15 @@ pub struct UserLocale {
 impl UserLocale {
 impl UserLocale {
     pub fn new() -> UserLocale {
     pub fn new() -> UserLocale {
         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 {
     pub fn default() -> UserLocale {
         UserLocale {
         UserLocale {
-            time: locale::Time::default(),
-            numeric: locale::Numeric::default(),
+            time: locale::Time::english(),
+            numeric: locale::Numeric::english(),
         }
         }
     }
     }
 }
 }