chore: apply cargo fmt + clippy cleanup across crate
Silence forward-looking dead_code on unused DAO modules, annotate individual placeholder items, rewrite tautological assert!(true/false) in token tests as panic! arms, and pick up fmt drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ impl Library {
|
||||
/// Resolve a library-relative path into an absolute `PathBuf` under the
|
||||
/// library root. Does not validate traversal — use `is_valid_full_path`
|
||||
/// for untrusted input.
|
||||
#[allow(dead_code)]
|
||||
pub fn resolve(&self, rel_path: &str) -> PathBuf {
|
||||
Path::new(&self.root_path).join(rel_path)
|
||||
}
|
||||
@@ -39,6 +40,7 @@ impl Library {
|
||||
/// Inverse of `resolve`: given an absolute path under this library's
|
||||
/// root, return the root-relative portion. Returns `None` if the path
|
||||
/// is not under the library.
|
||||
#[allow(dead_code)]
|
||||
pub fn strip_root(&self, abs_path: &Path) -> Option<String> {
|
||||
abs_path
|
||||
.strip_prefix(&self.root_path)
|
||||
@@ -99,10 +101,7 @@ pub fn seed_or_patch_from_env(conn: &mut SqliteConnection, base_path: &str) {
|
||||
|
||||
// If no rows exist at all (e.g. table created outside the seeded migration),
|
||||
// insert a primary library pointing at BASE_PATH.
|
||||
let total: i64 = libraries::table
|
||||
.count()
|
||||
.get_result(conn)
|
||||
.unwrap_or(0);
|
||||
let total: i64 = libraries::table.count().get_result(conn).unwrap_or(0);
|
||||
if total == 0 {
|
||||
let now = Utc::now().timestamp();
|
||||
let result = diesel::insert_into(libraries::table)
|
||||
@@ -113,7 +112,10 @@ pub fn seed_or_patch_from_env(conn: &mut SqliteConnection, base_path: &str) {
|
||||
})
|
||||
.execute(conn);
|
||||
match result {
|
||||
Ok(_) => info!("Seeded primary library 'main' with BASE_PATH='{}'", base_path),
|
||||
Ok(_) => info!(
|
||||
"Seeded primary library 'main' with BASE_PATH='{}'",
|
||||
base_path
|
||||
),
|
||||
Err(e) => warn!("Failed to seed primary library: {:?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user