Unverified Commit 3b06a9a2 authored by Vasili Novikov's avatar Vasili Novikov
Browse files

Fix clippy warnings

parent 07498107
Showing with 6 additions and 15 deletions
+6 -15
......@@ -4,3 +4,6 @@ pub const DATABASE_DIR: &str = "./data/db";
pub const DATABASE_SUFFIX: &str = ".db3";
pub const FILES_DIR: &str = "./data/files";
/// Directory where fully uploaded and hash-checked files are stored
/// (in future, the files should also be s3-uploaded).
pub const FILES_FINAL_SUBDIR: &str = "final";
......@@ -300,14 +300,6 @@ pub fn insert_string(tx: &Tx, item: Rowid, name: &str, value: &str) -> Result<()
Ok(())
}
/// Insert a "BLOB storage class" into the strings TEXT column
/// See "Type Affinity": https://www.sqlite.org/datatype3.html
pub fn insert_string_blob(tx: &Tx, item: Rowid, name: &str, value: &[u8]) -> Result<()> {
let mut stmt = tx.prepare_cached("INSERT INTO strings VALUES(?, ?, ?);")?;
stmt.execute(params![item, name, value])?;
Ok(())
}
pub fn delete_property(tx: &Tx, item: Rowid, name: &str) -> Result<()> {
let mut stmt = tx.prepare_cached("DELETE FROM integers WHERE item = ? AND name = ?;")?;
stmt.execute(params![item, name])?;
......
......@@ -90,7 +90,7 @@ fn file_exists_on_disk(owner: &str, sha256: &str) -> Result<bool> {
fn final_path(owner: &str, sha256: &str) -> Result<PathBuf> {
let result = files_dir()?;
let final_dir = result.join(owner).join(FINAL_DIR);
let final_dir = result.join(owner).join(constants::FILES_FINAL_SUBDIR);
create_dir_all(&final_dir).map_err(|err| Error {
code: StatusCode::INTERNAL_SERVER_ERROR,
msg: format!(
......@@ -166,10 +166,10 @@ fn find_key_and_nonce_by_sha256(tx: &Transaction, sha256: &str) -> Result<(Vec<u
let nonce = hex::decode(nonce)?;
Ok((key, nonce))
} else {
return Err(Error {
Err(Error {
code: StatusCode::NOT_FOUND,
msg: format!("Item with sha256={} not found", sha256),
});
})
}
}
......@@ -183,7 +183,3 @@ fn files_dir() -> Result<PathBuf> {
}
})
}
/// Directory where fully uploaded and hash-checked files are stored
/// (in future, the files should also be s3-uploaded).
const FINAL_DIR: &str = "final";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment