mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-09-27 20:59:02 +00:00
Use curlies consistently
This commit is contained in:
parent
e1d3512a69
commit
6ade060eb6
10
src/file.rs
10
src/file.rs
@ -185,6 +185,7 @@ impl<'a> File<'a> {
|
||||
let v = target_path.filename().unwrap();
|
||||
let filename = String::from_utf8_lossy(v).to_string();
|
||||
|
||||
// Use stat instead of lstat - we *want* to follow links.
|
||||
let link_target = fs::stat(&target_path).map(|stat| File {
|
||||
path: target_path.clone(),
|
||||
dir: self.dir,
|
||||
@ -212,10 +213,12 @@ impl<'a> File<'a> {
|
||||
// at one of those numbers and gained any information from it.
|
||||
if self.stat.kind == io::TypeDirectory {
|
||||
GREY.paint("-")
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
let (size, suffix) = if use_iec_prefixes {
|
||||
format_IEC_bytes(self.stat.size)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
format_metric_bytes(self.stat.size)
|
||||
};
|
||||
|
||||
@ -264,7 +267,8 @@ impl<'a> File<'a> {
|
||||
fn permission_bit(bits: io::FilePermission, bit: io::FilePermission, character: &'static str, style: Style) -> String {
|
||||
if bits.contains(bit) {
|
||||
style.paint(character.as_slice())
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
GREY.paint("-".as_slice())
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ pub struct Options {
|
||||
pub view: View,
|
||||
}
|
||||
|
||||
|
||||
impl Options {
|
||||
pub fn getopts(args: Vec<String>) -> Result<Options, int> {
|
||||
let opts = [
|
||||
|
@ -24,7 +24,8 @@ impl SortPart {
|
||||
Some(num) => Numeric(num),
|
||||
None => Stringular(slice.to_string()),
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
SortPart::Stringular(slice.to_ascii_lower())
|
||||
}
|
||||
}
|
||||
|
14
src/unix.rs
14
src/unix.rs
@ -104,25 +104,21 @@ impl Unix {
|
||||
let mut i = 0;
|
||||
|
||||
// The list of members is a pointer to a pointer of
|
||||
// characters, terminated by a null pointer. So the first call
|
||||
// to `as_ref` will always succeed, as that memory is
|
||||
// guaranteed to be there (unless we go past the end of RAM).
|
||||
// The second call will return None if it's a null pointer.
|
||||
|
||||
// characters, terminated by a null pointer.
|
||||
loop {
|
||||
match unsafe { group.offset(i).as_ref() } {
|
||||
Some(&username) => {
|
||||
if username == ptr::null() {
|
||||
return false;
|
||||
return false; // username was null, weird
|
||||
}
|
||||
else if unsafe { String::from_raw_buf(username as *const u8) } == *uname {
|
||||
return true;
|
||||
return true; // group found!
|
||||
}
|
||||
else {
|
||||
i += 1;
|
||||
i += 1; // try again with the next group
|
||||
}
|
||||
},
|
||||
None => return false,
|
||||
None => return false, // no more groups to check, and none found
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user