mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-25 01:46:02 +00:00
Upgrade to latest Rust nightly
- Lifetime changes in unix.rs - lexical_ordering -> cmp - from_utf8_lossy got moved into String - vec.get(n) -> vec[n]
This commit is contained in:
parent
90099f28cf
commit
4cbc1f063a
@ -89,7 +89,7 @@ fn grid_view(options: &Options, across: bool, dir: Dir) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let file = files.get(num);
|
let file = files[num];
|
||||||
let file_name = file.name.clone();
|
let file_name = file.name.clone();
|
||||||
let styled_name = file.file_colour().paint(file_name.as_slice());
|
let styled_name = file.file_colour().paint(file_name.as_slice());
|
||||||
if x == num_columns - 1 {
|
if x == num_columns - 1 {
|
||||||
@ -134,7 +134,7 @@ fn lines_view(options: &Options, columns: &Vec<Column>, dir: Dir) {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let column_widths: Vec<uint> = range(0, columns.len())
|
let column_widths: Vec<uint> = range(0, columns.len())
|
||||||
.map(|n| lengths.iter().map(|row| *row.get(n)).max().unwrap())
|
.map(|n| lengths.iter().map(|row| row[n]).max().unwrap())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for (field_widths, row) in lengths.iter().zip(table.iter()) {
|
for (field_widths, row) in lengths.iter().zip(table.iter()) {
|
||||||
@ -147,7 +147,7 @@ fn lines_view(options: &Options, columns: &Vec<Column>, dir: Dir) {
|
|||||||
print!("{}", row.get(num));
|
print!("{}", row.get(num));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let padding = *column_widths.get(num) - *field_widths.get(num);
|
let padding = column_widths[num] - field_widths[num];
|
||||||
print!("{}", column.alignment().pad_string(row.get(num), padding));
|
print!("{}", column.alignment().pad_string(row.get(num), padding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::io::{fs, IoResult};
|
use std::io::{fs, IoResult};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::str::from_utf8_lossy;
|
|
||||||
|
|
||||||
use ansi_term::{Paint, Colour, Plain, Style, Red, Green, Yellow, Blue, Purple, Cyan, Fixed};
|
use ansi_term::{Paint, Colour, Plain, Style, Red, Green, Yellow, Blue, Purple, Cyan, Fixed};
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ pub struct File<'a> {
|
|||||||
impl<'a> File<'a> {
|
impl<'a> File<'a> {
|
||||||
pub fn from_path(path: &'a Path, parent: &'a Dir) -> IoResult<File<'a>> {
|
pub fn from_path(path: &'a Path, parent: &'a Dir) -> IoResult<File<'a>> {
|
||||||
let v = path.filename().unwrap(); // fails if / or . or ..
|
let v = path.filename().unwrap(); // fails if / or . or ..
|
||||||
let filename = from_utf8_lossy(v).to_string();
|
let filename = String::from_utf8_lossy(v).to_string();
|
||||||
|
|
||||||
// Use lstat here instead of file.stat(), as it doesn't follow
|
// Use lstat here instead of file.stat(), as it doesn't follow
|
||||||
// symbolic links. Otherwise, the stat() call will fail if it
|
// symbolic links. Otherwise, the stat() call will fail if it
|
||||||
@ -160,7 +159,7 @@ impl<'a> File<'a> {
|
|||||||
|
|
||||||
fn target_file_name_and_arrow(&self, target_path: Path) -> String {
|
fn target_file_name_and_arrow(&self, target_path: Path) -> String {
|
||||||
let v = target_path.filename().unwrap();
|
let v = target_path.filename().unwrap();
|
||||||
let filename = from_utf8_lossy(v).to_string();
|
let filename = String::from_utf8_lossy(v).to_string();
|
||||||
|
|
||||||
let link_target = fs::stat(&target_path).map(|stat| File {
|
let link_target = fs::stat(&target_path).map(|stat| File {
|
||||||
path: &target_path,
|
path: &target_path,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
|
|
||||||
use file::File;
|
use file::File;
|
||||||
use std::cmp::lexical_ordering;
|
|
||||||
use column::{Column, Permissions, FileName, FileSize, User, Group, HardLinks, Inode, Blocks};
|
use column::{Column, Permissions, FileName, FileSize, User, Group, HardLinks, Inode, Blocks};
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ impl Options {
|
|||||||
Extension => files.sort_by(|a, b| {
|
Extension => files.sort_by(|a, b| {
|
||||||
let exts = a.ext.clone().map(|e| e.as_slice().to_ascii_lower()).cmp(&b.ext.clone().map(|e| e.as_slice().to_ascii_lower()));
|
let exts = a.ext.clone().map(|e| e.as_slice().to_ascii_lower()).cmp(&b.ext.clone().map(|e| e.as_slice().to_ascii_lower()));
|
||||||
let names = a.name.as_slice().to_ascii_lower().cmp(&b.name.as_slice().to_ascii_lower());
|
let names = a.name.as_slice().to_ascii_lower().cmp(&b.name.as_slice().to_ascii_lower());
|
||||||
lexical_ordering(exts, names)
|
exts.cmp(&names)
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ pub struct Unix {
|
|||||||
impl Unix {
|
impl Unix {
|
||||||
pub fn empty_cache() -> Unix {
|
pub fn empty_cache() -> Unix {
|
||||||
let uid = unsafe { c::getuid() };
|
let uid = unsafe { c::getuid() };
|
||||||
let info = unsafe { c::getpwuid(uid as i32).to_option().unwrap() }; // the user has to have a name
|
let infoptr = unsafe { c::getpwuid(uid as i32) };
|
||||||
|
let info = unsafe { infoptr.to_option().unwrap() }; // the user has to have a name
|
||||||
|
|
||||||
let username = unsafe { from_c_str(info.pw_name) };
|
let username = unsafe { from_c_str(info.pw_name) };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user