From 05b2d541acf3607eedd4f3eeee7e1e9401e0adcd Mon Sep 17 00:00:00 2001 From: Ben S Date: Mon, 26 May 2014 11:08:33 +0100 Subject: [PATCH] s/StrBuf/String/g --- colours.rs | 6 +++--- exa.rs | 2 +- file.rs | 10 +++++----- format.rs | 6 +++--- options.rs | 6 +++--- unix.rs | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/colours.rs b/colours.rs index 15a3f23..d818f34 100644 --- a/colours.rs +++ b/colours.rs @@ -16,7 +16,7 @@ pub struct StyleStruct { } impl Style { - pub fn paint(&self, input: &str) -> StrBuf { + pub fn paint(&self, input: &str) -> String { match *self { Plain => input.to_strbuf(), Foreground(c) => c.paint(input), @@ -63,7 +63,7 @@ impl Style { } impl Colour { - pub fn paint(&self, input: &str) -> StrBuf { + pub fn paint(&self, input: &str) -> String { let re = format!("\x1B[{}m{}\x1B[0m", *self as int, input); return re.to_owned(); } @@ -85,7 +85,7 @@ impl Colour { } } -pub fn strip_formatting(input: &StrBuf) -> StrBuf { +pub fn strip_formatting(input: &String) -> String { let re = regex!("\x1B\\[.+?m"); re.replace_all(input.as_slice(), "").to_owned() } diff --git a/exa.rs b/exa.rs index 03c0926..e9ce37f 100644 --- a/exa.rs +++ b/exa.rs @@ -51,7 +51,7 @@ fn exa(options: &Options, path: Path) { let columns = options.columns(); - let table: Vec> = files.iter() + let table: Vec> = files.iter() .filter(|&f| options.show(f)) .map(|f| columns.iter().map(|c| f.display(c)).collect()) .collect(); diff --git a/file.rs b/file.rs index d4b2a92..6550d09 100644 --- a/file.rs +++ b/file.rs @@ -55,7 +55,7 @@ impl<'a> File<'a> { self.name.starts_with(".") } - pub fn display(&self, column: &Column) -> StrBuf { + pub fn display(&self, column: &Column) -> String { match *column { Permissions => self.permissions(), FileName => self.file_colour().paint(self.name.as_slice()), @@ -65,7 +65,7 @@ impl<'a> File<'a> { } } - fn file_size(&self, si: bool) -> StrBuf { + fn file_size(&self, si: bool) -> String { // Don't report file sizes for directories. I've never looked // at one of those numbers and gained any information from it. if self.stat.kind == io::TypeDirectory { @@ -81,7 +81,7 @@ impl<'a> File<'a> { } } - fn type_char(&self) -> StrBuf { + fn type_char(&self) -> String { return match self.stat.kind { io::TypeFile => ".".to_strbuf(), io::TypeDirectory => Blue.paint("d"), @@ -116,7 +116,7 @@ impl<'a> File<'a> { } } - fn permissions(&self) -> StrBuf { + fn permissions(&self) -> String { let bits = self.stat.perm; return format!("{}{}{}{}{}{}{}{}{}{}", self.type_char(), @@ -133,7 +133,7 @@ impl<'a> File<'a> { } } -fn bit(bits: io::FilePermission, bit: io::FilePermission, other: &'static str, style: Style) -> StrBuf { +fn bit(bits: io::FilePermission, bit: io::FilePermission, other: &'static str, style: Style) -> String { if bits.contains(bit) { style.paint(other.as_slice()) } else { diff --git a/format.rs b/format.rs index 5ac7b80..4e67826 100644 --- a/format.rs +++ b/format.rs @@ -6,7 +6,7 @@ static IEC_PREFIXES: &'static [&'static str] = &[ "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" ]; -fn formatBytes(mut amount: u64, kilo: u64, prefixes: &[&str]) -> StrBuf { +fn formatBytes(mut amount: u64, kilo: u64, prefixes: &[&str]) -> String { let mut prefix = 0; while amount > kilo { amount /= kilo; @@ -15,10 +15,10 @@ fn formatBytes(mut amount: u64, kilo: u64, prefixes: &[&str]) -> StrBuf { format!("{}{}", amount, prefixes[prefix]) } -pub fn formatBinaryBytes(amount: u64) -> StrBuf { +pub fn formatBinaryBytes(amount: u64) -> String { formatBytes(amount, 1024, IEC_PREFIXES) } -pub fn formatDecimalBytes(amount: u64) -> StrBuf { +pub fn formatDecimalBytes(amount: u64) -> String { formatBytes(amount, 1000, METRIC_PREFIXES) } diff --git a/options.rs b/options.rs index 552799a..862e6f7 100644 --- a/options.rs +++ b/options.rs @@ -12,11 +12,11 @@ pub struct Options { pub showInvisibles: bool, pub sortField: SortField, pub reverse: bool, - pub dirs: Vec, + pub dirs: Vec, } impl SortField { - pub fn from_word(word: StrBuf) -> SortField { + pub fn from_word(word: String) -> SortField { match word.as_slice() { "name" => Name, "size" => Size, @@ -39,7 +39,7 @@ impl SortField { } impl Options { - pub fn getopts(args: Vec) -> Result { + pub fn getopts(args: Vec) -> Result { let opts = ~[ getopts::optflag("a", "all", "show dot-files"), getopts::optflag("r", "reverse", "reverse order of files"), diff --git a/unix.rs b/unix.rs index 5ce9d8d..bfbb4f8 100644 --- a/unix.rs +++ b/unix.rs @@ -34,7 +34,7 @@ mod c { } } -pub fn get_user_name(uid: i32) -> Option { +pub fn get_user_name(uid: i32) -> Option { let pw = unsafe { c::getpwuid(uid) }; if pw.is_not_null() { return unsafe { Some(from_c_str(read(pw).pw_name)) }; @@ -44,7 +44,7 @@ pub fn get_user_name(uid: i32) -> Option { } } -pub fn get_group_name(gid: u32) -> Option { +pub fn get_group_name(gid: u32) -> Option { let gr = unsafe { c::getgrgid(gid) }; if gr.is_not_null() { return unsafe { Some(from_c_str(read(gr).gr_name)) };