cargo fmt

Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
bin liu
2020-09-09 16:42:55 +08:00
parent ff6a0ea82a
commit 250ada183a
27 changed files with 534 additions and 448 deletions
+8 -5
View File
@@ -11,12 +11,11 @@ use std::fs::File;
use std::io::{Read, Write};
use std::path::PathBuf;
use crate::error::*;
use crate::error::ErrorKind::*;
use crate::error::*;
use crate::{
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources,
Subsystem,
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources, Subsystem,
};
/// A controller that allows controlling the `net_cls` subsystem of a Cgroup.
@@ -81,7 +80,10 @@ impl<'a> From<&'a Subsystem> for &'a NetClsController {
fn read_u64_from(mut file: File) -> Result<u64> {
let mut string = String::new();
match file.read_to_string(&mut string) {
Ok(_) => string.trim().parse().map_err(|e| Error::with_cause(ParseError, e)),
Ok(_) => string
.trim()
.parse()
.map_err(|e| Error::with_cause(ParseError, e)),
Err(e) => Err(Error::with_cause(ReadFailed, e)),
}
}
@@ -102,7 +104,8 @@ impl NetClsController {
self.open_path("net_cls.classid", true)
.and_then(|mut file| {
let s = format!("{:#08X}", class);
file.write_all(s.as_ref()).map_err(|e| Error::with_cause(WriteFailed, e))
file.write_all(s.as_ref())
.map_err(|e| Error::with_cause(WriteFailed, e))
})
}