Skip to content

Commit

Permalink
write -> write_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Takuya Hashimoto committed Nov 19, 2020
1 parent 98d0850 commit be70aa3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ pub async fn list_backups(cx: app::Context, all_tables: bool) -> Result<(), IOEr
let backups = list_backups_api(&cx, all_tables).await;
let mut tw = TabWriter::new(io::stdout());
// First defining header
tw.write(((vec![ "Table", "Status", "CreatedAt", "BackupName (size)" ].join("\t")) + "\n").as_bytes())?;
tw.write_all(((vec![ "Table", "Status", "CreatedAt", "BackupName (size)" ].join("\t")) + "\n").as_bytes())?;
for backup in backups {
let line = vec![
backup.table_name.expect("table name should exist"),
Expand All @@ -447,7 +447,7 @@ pub async fn list_backups(cx: app::Context, all_tables: bool) -> Result<(), IOEr
backup.backup_name.expect("backup name should exist") + &format!(" ({} bytes)", backup.backup_size_bytes.expect("size should exist")),
String::from("\n")
];
tw.write(line.join("\t").as_bytes())?;
tw.write_all(line.join("\t").as_bytes())?;
}
tw.flush()?;
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ fn display_items_table(items: Vec<HashMap<String, AttributeValue>>, ts: &app::Ta
debug!("built header elements: {:?}", header);

let mut tw = TabWriter::new(io::stdout());
tw.write((header.join("\t") + "\n").as_bytes()).unwrap();
tw.write_all((header.join("\t") + "\n").as_bytes()).unwrap();

// `cells` is sth like: ["item1-pk\titem1-attr1\titem1-attr2", "item2-pk\titem2-attr1\titem2-attr2"]
let mut cells: Vec<String> = vec![]; // may be able to use with_capacity to initialize the vec.
Expand Down Expand Up @@ -924,7 +924,7 @@ fn display_items_table(items: Vec<HashMap<String, AttributeValue>>, ts: &app::Ta
}
}

tw.write((cells.join("\n") + "\n").as_bytes()).unwrap();
tw.write_all((cells.join("\n") + "\n").as_bytes()).unwrap();
tw.flush().unwrap();
}

Expand Down

0 comments on commit be70aa3

Please sign in to comment.