Skip to content

Commit 717b850

Browse files
authored
Merge pull request #79 from nazar-pc/fix-formatting
Fix formatting
2 parents d226ed5 + dd239d3 commit 717b850

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/column.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl HashColumn {
513513
stats,
514514
)? {
515515
(Some(outcome), _) => return Ok(outcome),
516-
(None, Some(value_address)) =>
516+
(None, Some(value_address)) => {
517517
if value.is_some() {
518518
// If it was found in an older index we just insert a new entry. Reindex won't
519519
// overwrite it.
@@ -523,7 +523,8 @@ impl HashColumn {
523523
} else {
524524
log::trace!(target: "parity-db", "{}: Removing from index {}", tables.index.id, hex(key));
525525
index.write_remove_plan(key, sub_index, log)?;
526-
},
526+
}
527+
},
527528
_ => unreachable!(),
528529
}
529530
Ok(PlanOutcome::Skipped)

src/file.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,22 @@ impl TableFile {
137137
#[cfg(windows)]
138138
pub fn read_at(&self, mut buf: &mut [u8], mut offset: u64) -> Result<()> {
139139
use crate::error::Error;
140-
use std::io;
141-
use std::os::windows::fs::FileExt;
140+
use std::{io, os::windows::fs::FileExt};
142141

143142
let file = self.file.read();
144143
let file = file.as_ref().unwrap();
145144

146145
while !buf.is_empty() {
147146
match file.seek_read(buf, offset) {
148-
Ok(0) => {
149-
break;
150-
},
147+
Ok(0) => break,
151148
Ok(n) => {
152149
buf = &mut buf[n..];
153150
offset += n as u64;
154151
},
155152
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {
156153
// Try again
157154
},
158-
Err(e) => {
159-
return Err(Error::Io(e));
160-
},
155+
Err(e) => return Err(Error::Io(e)),
161156
}
162157
}
163158

@@ -174,31 +169,27 @@ impl TableFile {
174169
#[cfg(windows)]
175170
pub fn write_at(&self, mut buf: &[u8], mut offset: u64) -> Result<()> {
176171
use crate::error::Error;
177-
use std::io;
178-
use std::os::windows::fs::FileExt;
172+
use std::{io, os::windows::fs::FileExt};
179173

180174
self.dirty.store(true, Ordering::Relaxed);
181175
let file = self.file.read();
182176
let file = file.as_ref().unwrap();
183177

184178
while !buf.is_empty() {
185179
match file.seek_write(buf, offset) {
186-
Ok(0) => {
180+
Ok(0) =>
187181
return Err(Error::Io(io::Error::new(
188182
io::ErrorKind::WriteZero,
189183
"failed to write whole buffer",
190-
)));
191-
},
184+
))),
192185
Ok(n) => {
193186
buf = &buf[n..];
194187
offset += n as u64;
195188
},
196189
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {
197190
// Try again
198191
},
199-
Err(e) => {
200-
return Err(Error::Io(e));
201-
},
192+
Err(e) => return Err(Error::Io(e)),
202193
}
203194
}
204195

0 commit comments

Comments
 (0)