clippy: as_bytes on string literals

This commit is contained in:
Graham Christensen 2019-01-02 19:13:05 -05:00
parent 2b338c3549
commit f2a0ca259e
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
3 changed files with 5 additions and 5 deletions

View file

@ -145,7 +145,7 @@ impl OutPaths {
fn place_nix(&self) {
let mut file = File::create(self.nix_path()).expect("Failed to create nix out path check");
file.write_all(include_str!("outpaths.nix").as_bytes())
file.write_all(include_bytes!("outpaths.nix"))
.expect("Failed to place outpaths.nix");
}

View file

@ -32,9 +32,9 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for StatCollectorWorker
match serde_json::from_slice(body) {
Ok(e) => Ok(e),
Err(_) => {
let mut modified_body: Vec<u8> = vec!["\"".as_bytes()[0]];
let mut modified_body: Vec<u8> = vec![b"\""[0]];
modified_body.append(&mut body.to_vec());
modified_body.push("\"".as_bytes()[0]);
modified_body.push(b"\""[0]);
match serde_json::from_slice(&modified_body) {
Ok(e) => {

View file

@ -54,7 +54,7 @@ impl LineWriter {
self.file
.write_all(self.buffer.join("\n").as_bytes())
.unwrap();
self.file.write("\n".as_bytes()).unwrap();
self.file.write(b"\n").unwrap();
} else {
// println!("taking the append option");
// println!("Writing {:?} to line {}", data, line);
@ -70,7 +70,7 @@ impl LineWriter {
// end
// println!("selected buffer: {:?}", to_write);
self.file.write(to_write.as_bytes()).unwrap();
self.file.write("\n".as_bytes()).unwrap();
self.file.write(b"\n").unwrap();
}
self.last_line = line;