linting changes

This commit is contained in:
2020-11-09 09:56:24 +01:00
parent 647881f022
commit 467c8ee007
15 changed files with 142 additions and 143 deletions
+5 -5
View File
@@ -17,8 +17,8 @@ fn test_test() {
let mf = adduser::Files {
passwd: Some(p.path.clone()),
shadow: Some(s.path.clone()),
group: Some(g.path.clone()),
shadow: Some(s.path),
group: Some(g.path),
};
let mut db = adduser::UserDBLocal::load_files(mf).unwrap();
@@ -32,9 +32,9 @@ fn test_test() {
);
let pf2 = fs::read_to_string(&p.path).unwrap();
assert_eq!(user_res.unwrap().get_username().unwrap(), "teste");
let pfl = pf.lines();
let pfl2 = pf2.lines();
for (l1, l2) in pfl.zip(pfl2) {
let pflines = pf.lines();
let pflines2 = pf2.lines();
for (l1, l2) in pflines.zip(pflines2) {
if l1 != l2 {
dbg!(l1, l2);
assert!(l1.starts_with("teste"));
+5 -3
View File
@@ -12,6 +12,7 @@ pub struct Fixture {
}
impl Fixture {
#[must_use]
pub fn blank(fixture_filename: &str) -> Self {
// First, figure out the right file in `tests/fixtures/`:
let root_dir = &env::var("CARGO_MANIFEST_DIR").expect("$CARGO_MANIFEST_DIR");
@@ -24,14 +25,15 @@ impl Fixture {
let mut path = PathBuf::from(&tempdir.path());
path.push(&fixture_filename);
Fixture {
Self {
_tempdir: tempdir,
source,
path,
}
}
#[must_use]
pub fn copy(fixture_filename: &str) -> Self {
let fixture = Fixture::blank(fixture_filename);
let fixture = Self::blank(fixture_filename);
fs::copy(&fixture.source, &fixture.path).unwrap();
fixture
}
@@ -41,6 +43,6 @@ impl Deref for Fixture {
type Target = Path;
fn deref(&self) -> &Self::Target {
self.path.deref()
&self.path
}
}