Replace use of .iter() with reference

This commit is contained in:
Daniel Lockyer 2017-03-31 17:08:11 +01:00
parent 3bce55f569
commit da3061d1b3
3 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
self.args.push(".".to_owned());
}
for file_name in self.args.iter() {
for file_name in &self.args {
match File::from_path(Path::new(&file_name), None) {
Err(e) => {
writeln!(stderr(), "{}: {}", file_name, e)?;

View File

@ -481,7 +481,7 @@ impl<'a, U: Users+Groups+'a> Table<'a, U> {
/// Use the list of columns to find which cells should be produced for
/// this file, per-column.
pub fn cells_for_file(&self, file: &File, xattrs: bool) -> Vec<TextCell> {
self.columns.clone().iter()
self.columns.iter()
.map(|c| self.display(file, c, xattrs))
.collect()
}

View File

@ -122,7 +122,7 @@ impl GridDetails {
if self.grid.across {
for row in 0 .. height {
for column in columns.iter() {
for column in &columns {
if row < column.len() {
let cell = grid::Cell {
contents: ANSIStrings(&column[row].contents).to_string(),
@ -135,7 +135,7 @@ impl GridDetails {
}
}
else {
for column in columns.iter() {
for column in &columns {
for cell in column.iter() {
let cell = grid::Cell {
contents: ANSIStrings(&cell.contents).to_string(),