patches errors from clippy::seek_to_start_instead_of_rewind
https://rust-lang.github.io/rust-clippy/master/index.html#seek_to_start_instead_of_rewind
This commit is contained in:
parent
bbd49acb2f
commit
401f66c830
|
@ -317,7 +317,7 @@ impl BucketStorage {
|
|||
data.seek(SeekFrom::Start(capacity * cell_size as u64 - 1))
|
||||
.unwrap();
|
||||
data.write_all(&[0]).unwrap();
|
||||
data.seek(SeekFrom::Start(0)).unwrap();
|
||||
data.rewind().unwrap();
|
||||
measure_new_file.stop();
|
||||
let mut measure_flush = Measure::start("measure_flush");
|
||||
data.flush().unwrap(); // can we skip this?
|
||||
|
|
|
@ -22,7 +22,7 @@ use {
|
|||
std::{
|
||||
fmt::{Debug, Formatter},
|
||||
fs::File,
|
||||
io::{Read, Seek, SeekFrom},
|
||||
io::{Read, Seek},
|
||||
path::Path,
|
||||
time::{Duration, Instant},
|
||||
},
|
||||
|
@ -244,7 +244,7 @@ before execting it in the virtual machine.",
|
|||
let mut file = File::open(Path::new(program)).unwrap();
|
||||
let mut magic = [0u8; 4];
|
||||
file.read_exact(&mut magic).unwrap();
|
||||
file.seek(SeekFrom::Start(0)).unwrap();
|
||||
file.rewind().unwrap();
|
||||
let mut contents = Vec::new();
|
||||
file.read_to_end(&mut contents).unwrap();
|
||||
let syscall_registry = register_syscalls(&invoke_context.feature_set, true).unwrap();
|
||||
|
|
|
@ -333,7 +333,7 @@ impl AppendVec {
|
|||
// expensive.
|
||||
data.seek(SeekFrom::Start((size - 1) as u64)).unwrap();
|
||||
data.write_all(&[0]).unwrap();
|
||||
data.seek(SeekFrom::Start(0)).unwrap();
|
||||
data.rewind().unwrap();
|
||||
data.flush().unwrap();
|
||||
|
||||
//UNSAFE: Required to create a Mmap
|
||||
|
|
|
@ -126,7 +126,7 @@ impl CacheHashDataFile {
|
|||
// expensive.
|
||||
data.seek(SeekFrom::Start(capacity - 1)).unwrap();
|
||||
data.write_all(&[0]).unwrap();
|
||||
data.seek(SeekFrom::Start(0)).unwrap();
|
||||
data.rewind().unwrap();
|
||||
data.flush().unwrap();
|
||||
Ok(unsafe { MmapMut::map_mut(&data).unwrap() })
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue