diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-05 07:20:25 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-05 07:20:25 +0000 |
commit | fff45f4865a4144fdeaa879bf655fa204b2fb45d (patch) | |
tree | b6e7fa191612046e9978f1cc5df47511ca5cb839 /src/generation.rs | |
parent | 7dc514d0baecbb0a4190a701ff1266f7d6a096d2 (diff) | |
parent | 496cedc9dfdad1c894a91ca0f39c022ac1bd9fb1 (diff) | |
download | obnam2-fff45f4865a4144fdeaa879bf655fa204b2fb45d.tar.gz |
Merge branch 'tidy-up' into 'main'
tidy up
Closes #169
See merge request obnam/obnam!198
Diffstat (limited to 'src/generation.rs')
-rw-r--r-- | src/generation.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/generation.rs b/src/generation.rs index 6613c02..71821d8 100644 --- a/src/generation.rs +++ b/src/generation.rs @@ -344,7 +344,7 @@ mod sql { pub fn meta(conn: &Connection) -> Result<HashMap<String, String>, LocalGenerationError> { let mut stmt = conn.prepare("SELECT key, value FROM meta")?; - let iter = stmt.query_map(params![], |row| row_to_key_value(row))?; + let iter = stmt.query_map(params![], row_to_key_value)?; let mut map = HashMap::new(); for r in iter { let (key, value) = r?; @@ -414,9 +414,9 @@ mod sql { // a "fallible iterator" is.) // // The iterator is only valid for the lifetime of the associated SQLite statement; we - // call this lifetime 'stmt, and use it both both on the reference and the returned iterator. + // call this lifetime 'stmt, and use it both both on the reference and the returned Now. // - // Now we're in a pickle: all named lifetimes have to be declared _somewhere_, but we can't add + // we iterator're in a pickle: all named lifetimes have to be declared _somewhere_, but we can't add // 'stmt to the signature of `CreateIterFn` because then we'll have to specify it when we // define the function. Obviously, at that point we won't yet have a `Statement`, and thus we // would have no idea what its lifetime is going to be. So we can't put the 'stmt lifetime into @@ -460,7 +460,7 @@ mod sql { conn, "SELECT * FROM files", Box::new(|stmt| { - let iter = stmt.query_map(params![], |row| row_to_entry(row))?; + let iter = stmt.query_map(params![], row_to_entry)?; let iter = iter.map(|x| match x { Ok((fileno, json, reason)) => serde_json::from_str(&json) .map(|entry| BackedUpFile::new(fileno, entry, &reason)) @@ -515,8 +515,7 @@ mod sql { filename: &Path, ) -> Result<Option<(FileId, FilesystemEntry, String)>, LocalGenerationError> { let mut stmt = conn.prepare("SELECT * FROM files WHERE filename = ?1")?; - let mut iter = - stmt.query_map(params![path_into_blob(filename)], |row| row_to_entry(row))?; + let mut iter = stmt.query_map(params![path_into_blob(filename)], row_to_entry)?; match iter.next() { None => Ok(None), Some(Err(e)) => { |