Skip to content

Commit d062aaa

Browse files
author
Dennis Schwerdel
committed
Reformatted using rustfmt
1 parent 15ab556 commit d062aaa

40 files changed

+2736
-951
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This project follows [semantic versioning](http://semver.org).
88
* [added] Added support for xattrs in fuse mount
99
* [added] Added support for block/char devices
1010
* [added] Added support for fifo files
11+
* [modified] Reformatted sources using rustfmt
1112
* [modified] Also documenting common flags in subcommands
1213
* [modified] Using repository aliases (**conversion needed**)
1314
* [modified] Remote path must be absolute

rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
trailing_semicolon = false
2+
trailing_comma = "Never"

src/bundledb/cache.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ::prelude::*;
1+
use prelude::*;
22

33
use std::path::{Path, PathBuf};
44
use std::fs::{self, File};
@@ -62,7 +62,11 @@ impl StoredBundle {
6262
self.info.id.clone()
6363
}
6464

65-
pub fn copy_to<P: AsRef<Path>>(&self, base_path: &Path, path: P) -> Result<Self, BundleDbError> {
65+
pub fn copy_to<P: AsRef<Path>>(
66+
&self,
67+
base_path: &Path,
68+
path: P,
69+
) -> Result<Self, BundleDbError> {
6670
let src_path = base_path.join(&self.path);
6771
let dst_path = path.as_ref();
6872
try!(fs::copy(&src_path, dst_path).context(dst_path));
@@ -71,7 +75,11 @@ impl StoredBundle {
7175
Ok(bundle)
7276
}
7377

74-
pub fn move_to<P: AsRef<Path>>(&mut self, base_path: &Path, path: P) -> Result<(), BundleDbError> {
78+
pub fn move_to<P: AsRef<Path>>(
79+
&mut self,
80+
base_path: &Path,
81+
path: P,
82+
) -> Result<(), BundleDbError> {
7583
let src_path = base_path.join(&self.path);
7684
let dst_path = path.as_ref();
7785
if fs::rename(&src_path, dst_path).is_err() {
@@ -88,20 +96,24 @@ impl StoredBundle {
8896
let mut header = [0u8; 8];
8997
try!(file.read_exact(&mut header).map_err(BundleCacheError::Read));
9098
if header[..CACHE_FILE_STRING.len()] != CACHE_FILE_STRING {
91-
return Err(BundleCacheError::WrongHeader)
99+
return Err(BundleCacheError::WrongHeader);
92100
}
93101
let version = header[CACHE_FILE_STRING.len()];
94102
if version != CACHE_FILE_VERSION {
95-
return Err(BundleCacheError::UnsupportedVersion(version))
103+
return Err(BundleCacheError::UnsupportedVersion(version));
96104
}
97105
Ok(try!(msgpack::decode_from_stream(&mut file)))
98106
}
99107

100108
pub fn save_list_to<P: AsRef<Path>>(list: &[Self], path: P) -> Result<(), BundleCacheError> {
101109
let path = path.as_ref();
102110
let mut file = BufWriter::new(try!(File::create(path).map_err(BundleCacheError::Write)));
103-
try!(file.write_all(&CACHE_FILE_STRING).map_err(BundleCacheError::Write));
104-
try!(file.write_all(&[CACHE_FILE_VERSION]).map_err(BundleCacheError::Write));
111+
try!(file.write_all(&CACHE_FILE_STRING).map_err(
112+
BundleCacheError::Write
113+
));
114+
try!(file.write_all(&[CACHE_FILE_VERSION]).map_err(
115+
BundleCacheError::Write
116+
));
105117
try!(msgpack::encode_to_stream(&list, &mut file));
106118
Ok(())
107119
}

0 commit comments

Comments
 (0)