agent: lumotia — pin rust toolchain + workspace clippy/fmt sweep

rust-toolchain.toml pins to stable 1.94.1 so contributors and CI runners
share the exact rustc / rustfmt / clippy versions. Without the pin, every
machine surfaces a different lint set depending on its local install — six
pre-existing lints showed up on 1.94.1 that 1.93-era HANDOVER reported clean.

Clippy fixes (all pre-existing, not introduced by feature work):

- crates/storage/src/database.rs: std::iter::repeat().take() -> repeat_n()
- crates/llm/src/lib.rs (docs): "+ frontends" was parsed as a markdown bullet
  continuation by rustdoc, breaking doc-lazy-continuation. Reworded to "and".
- crates/llm/src/lib.rs (loop): while-let-on-iterator -> for-loop.
- src-tauri/src/commands/security.rs: .iter().any(|a| *a == x) -> .contains(&x).
- src-tauri/src/lib.rs: io::Error::new(Other, e) -> io::Error::other(e).
- src-tauri/src/tauri_app_data_migration.rs: drop function-tail `return`s
  inside cfg blocks; each platform's block now ends with a tail expression.

cargo fmt sweep across the workspace. Mechanical layout-only changes;
no semantics affected.

Workspace gates after this commit:
- cargo fmt --check: clean
- cargo clippy --workspace --all-targets -- -D warnings: clean
- cargo test --workspace: 405/0 (will become 409/0 with Phase A.1+A.2)
This commit is contained in:
2026-05-14 07:19:59 +01:00
parent e4d56b831f
commit 27661c816e
24 changed files with 184 additions and 210 deletions

View File

@@ -41,16 +41,10 @@ pub enum AppDataMigrationStatus {
/// after the first successful migration (we preserve legacy as a
/// backup), so the warning is informational rather than an
/// indication of trouble.
BothExistLegacyPreserved {
old: PathBuf,
new: PathBuf,
},
BothExistLegacyPreserved { old: PathBuf, new: PathBuf },
/// Migration succeeded: legacy copied to new path via atomic
/// staging rename, legacy preserved as a backup.
Migrated {
old: PathBuf,
new: PathBuf,
},
Migrated { old: PathBuf, new: PathBuf },
}
/// Resolve the OLD Tauri `app_data_dir` from platform conventions. The
@@ -67,6 +61,10 @@ pub fn legacy_tauri_app_data_dir() -> Option<PathBuf> {
}
fn legacy_tauri_app_data_dir_for(identifier: &str) -> Option<PathBuf> {
// Exactly one of the four cfg blocks below is present per target
// compile. Each is a tail expression that becomes the function's
// return value. Avoiding explicit `return` keeps clippy's
// needless_return lint happy on every platform.
#[cfg(target_os = "linux")]
{
// XDG_DATA_HOME wins when set and non-empty, per the XDG Base
@@ -79,29 +77,29 @@ fn legacy_tauri_app_data_dir_for(identifier: &str) -> Option<PathBuf> {
}
}
let home = std::env::var("HOME").ok().filter(|s| !s.is_empty())?;
return Some(
Some(
PathBuf::from(home)
.join(".local")
.join("share")
.join(identifier),
);
)
}
#[cfg(target_os = "macos")]
{
let home = std::env::var("HOME").ok().filter(|s| !s.is_empty())?;
return Some(
Some(
PathBuf::from(home)
.join("Library")
.join("Application Support")
.join(identifier),
);
)
}
#[cfg(target_os = "windows")]
{
let appdata = std::env::var("APPDATA").ok().filter(|s| !s.is_empty())?;
return Some(PathBuf::from(appdata).join(identifier));
Some(PathBuf::from(appdata).join(identifier))
}
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
@@ -123,10 +121,7 @@ fn legacy_tauri_app_data_dir_for(identifier: &str) -> Option<PathBuf> {
/// `paths.rs` migration already covers the user's transcripts and
/// models, so even a total-failure here only loses webview-keyed state
/// (preferences, session storage, plugin geometry).
pub fn migrate_tauri_app_data_dir_with_paths(
old: &Path,
new: &Path,
) -> AppDataMigrationStatus {
pub fn migrate_tauri_app_data_dir_with_paths(old: &Path, new: &Path) -> AppDataMigrationStatus {
let old_exists = old.exists();
let new_exists = new.exists();
@@ -265,7 +260,10 @@ mod tests {
assert!(leveldb.exists());
// Staging directory is cleaned up.
assert!(!tmp.path().join("consulting.corbel.lumotia.migrating").exists());
assert!(!tmp
.path()
.join("consulting.corbel.lumotia.migrating")
.exists());
}
#[test]
@@ -329,6 +327,9 @@ mod tests {
AppDataMigrationStatus::BothExistLegacyPreserved { .. }
));
assert_eq!(fs::read(new.join("file.txt")).unwrap(), b"v2-edited-by-user");
assert_eq!(
fs::read(new.join("file.txt")).unwrap(),
b"v2-edited-by-user"
);
}
}