ソースを参照

Upgrade code and libraries to latest Rust

std::str changes, and the way macros are expanded.
Ben S 11 年 前
コミット
e3a8342173
3 ファイル変更16 行追加10 行削除
  1. 7 7
      Cargo.lock
  2. 8 2
      src/column.rs
  3. 1 1
      src/options.rs

+ 7 - 7
Cargo.lock

@@ -3,20 +3,20 @@ name = "exa"
 version = "0.1.0"
 dependencies = [
  "ansi_term 0.4.0 (git+https://github.com/ogham/rust-ansi-term.git)",
- "natord 1.0.0 (git+https://github.com/lifthrasiir/rust-natord.git)",
+ "natord 1.0.1 (git+https://github.com/lifthrasiir/rust-natord.git)",
  "number_prefix 0.2.0 (git+https://github.com/ogham/rust-number-prefix.git)",
- "users 0.1.0 (git+https://github.com/ogham/rust-users.git)",
+ "users 0.1.1 (git+https://github.com/ogham/rust-users.git)",
 ]
 
 [[package]]
 name = "ansi_term"
 version = "0.4.0"
-source = "git+https://github.com/ogham/rust-ansi-term.git#19b6f71c716ec56fb960c84f3012fb374e8ac1e3"
+source = "git+https://github.com/ogham/rust-ansi-term.git#7e051531231838dc9431ec099ddf9fe9cc04c558"
 
 [[package]]
 name = "natord"
-version = "1.0.0"
-source = "git+https://github.com/lifthrasiir/rust-natord.git#83ebf6e7999fe2646bca45d5f6800728a0bbd5c5"
+version = "1.0.1"
+source = "git+https://github.com/lifthrasiir/rust-natord.git#fecab8556a4a6675577166bc2c0e269ede1ccc80"
 
 [[package]]
 name = "number_prefix"
@@ -25,6 +25,6 @@ source = "git+https://github.com/ogham/rust-number-prefix.git#3f690804a3f1704ee9
 
 [[package]]
 name = "users"
-version = "0.1.0"
-source = "git+https://github.com/ogham/rust-users.git#221a1463d3e25acac41615186a1c7fdcf0ad36d7"
+version = "0.1.1"
+source = "git+https://github.com/ogham/rust-users.git#c2911ab96a2b2459333029dde3728bfb5847ef04"
 

+ 8 - 2
src/column.rs

@@ -1,3 +1,5 @@
+use std::iter::repeat;
+
 pub enum Column {
     Permissions,
     FileName,
@@ -53,6 +55,10 @@ impl Column {
     }
 }
 
+fn spaces(length: uint) -> String {
+    repeat(" ").take(length).collect()
+}
+
 // An Alignment is used to pad a string to a certain length, letting
 // it pick which end it puts the text on. It takes the amount of
 // padding to apply, rather than the width the text should end up,
@@ -61,8 +67,8 @@ impl Column {
 impl Alignment {
     pub fn pad_string(&self, string: &String, padding: uint) -> String {
         match *self {
-            Alignment::Left  => format!("{}{}", string, " ".repeat(padding).as_slice()),
-            Alignment::Right => format!("{}{}", " ".repeat(padding), string.as_slice()),
+            Alignment::Left  => format!("{}{}", string, spaces(padding).as_slice()),
+            Alignment::Right => format!("{}{}", spaces(padding), string.as_slice()),
         }
     }
 }

+ 1 - 1
src/options.rs

@@ -72,7 +72,7 @@ impl Options {
         };
 
         if matches.opt_present("help") {
-            println!("exa - ls with more features\n\n{}", getopts::usage("Usage:\n  exa [options] [files...]", &opts))
+            println!("exa - ls with more features\n\n{}", getopts::usage("Usage:\n  exa [options] [files...]", &opts));
             return Err(2);
         }