Skip to content

Commit ebc11bc

Browse files
Adronclaude
andcommitted
fix(linux): resolve clippy unused-var and as_*-convention lints
Linux CI clippy --all-targets -D warnings (which lints cfg(linux) and test code the macOS host cannot) flagged two issues in main.rs: - secret_backend bound but unused in the daemon flow (the --status command re-probes the backend itself) -> rename to _secret_backend, matching the non-Linux branch - MockSecretStore::as_arc_dyn(self) takes self by value -> rename to into_arc_dyn per the as_*/into_ self-convention (clippy::wrong_self_convention) Verified locally with cargo clippy --workspace --all-targets -- -D warnings (the into_arc_dyn fix is in cfg(test) code, so it compiles on macOS) and cargo fmt --check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cdcea04 commit ebc11bc

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

  • linux-ubuntu/crates/interlinedlist-sync/src

linux-ubuntu/crates/interlinedlist-sync/src/main.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ async fn main() -> Result<()> {
102102
// On Linux, prefer GNOME Keyring; fall back to file store if keyring init
103103
// fails (e.g., headless SSH sessions without a keyring daemon running).
104104
// On non-Linux hosts, always use the file store.
105+
// `_secret_backend` is unused in the daemon flow (the --status command
106+
// re-probes the backend independently); bind it with a leading underscore
107+
// to match the non-Linux branch below and satisfy clippy.
105108
#[cfg(target_os = "linux")]
106-
let (secret_store, secret_backend): (Arc<dyn SecretStore>, SecretBackend) = {
109+
let (secret_store, _secret_backend): (Arc<dyn SecretStore>, SecretBackend) = {
107110
match KeyringSecretStore::new_checked().await {
108111
Ok(ks) => {
109112
info!("using GNOME Keyring for credential storage");
@@ -667,7 +670,7 @@ mod tests {
667670
*self.token.lock().unwrap() = Some(t.into());
668671
}
669672

670-
fn as_arc_dyn(self) -> Arc<dyn SecretStore> {
673+
fn into_arc_dyn(self) -> Arc<dyn SecretStore> {
671674
Arc::new(self)
672675
}
673676
}
@@ -701,7 +704,7 @@ mod tests {
701704
async fn no_token_then_signal_transitions_to_idle() {
702705
let mock = MockSecretStore::empty();
703706
let mock_clone = mock.clone();
704-
let store: Arc<dyn SecretStore> = mock.as_arc_dyn();
707+
let store: Arc<dyn SecretStore> = mock.into_arc_dyn();
705708

706709
let (status_tx, status_rx) = tokio::sync::watch::channel(SyncStatus::Idle);
707710
let (creds_tx, creds_rx) = tokio::sync::oneshot::channel::<()>();
@@ -728,7 +731,7 @@ mod tests {
728731

729732
#[tokio::test]
730733
async fn token_already_present_exits_immediately() {
731-
let store = MockSecretStore::with_token("existing_tok").as_arc_dyn();
734+
let store = MockSecretStore::with_token("existing_tok").into_arc_dyn();
732735
let (status_tx, status_rx) = tokio::sync::watch::channel(SyncStatus::WaitingForCredentials);
733736
// Drop the tx side so the receiver sees an immediate error, ensuring
734737
// we don't rely on the signal path.
@@ -752,7 +755,7 @@ mod tests {
752755
async fn poll_fallback_detects_token_without_signal() {
753756
let mock = MockSecretStore::empty();
754757
let mock_clone = mock.clone();
755-
let store = mock.as_arc_dyn();
758+
let store = mock.into_arc_dyn();
756759

757760
let (status_tx, status_rx) = tokio::sync::watch::channel(SyncStatus::Idle);
758761

@@ -784,7 +787,7 @@ mod tests {
784787
async fn oneshot_signal_wakes_wait_loop() {
785788
let mock = MockSecretStore::empty();
786789
let mock_clone = mock.clone();
787-
let store = mock.as_arc_dyn();
790+
let store = mock.into_arc_dyn();
788791

789792
let (status_tx, status_rx) = tokio::sync::watch::channel(SyncStatus::Idle);
790793
let (creds_tx, creds_rx) = tokio::sync::oneshot::channel::<()>();
@@ -821,7 +824,7 @@ mod tests {
821824

822825
#[tokio::test]
823826
async fn initial_status_is_waiting_when_no_token() {
824-
let store = MockSecretStore::empty().as_arc_dyn();
827+
let store = MockSecretStore::empty().into_arc_dyn();
825828
// Simulate the check done in run_daemon before the watch channel is built.
826829
let has_token = store.load_token("default").await.is_ok();
827830
let initial = if has_token {
@@ -836,7 +839,7 @@ mod tests {
836839

837840
#[tokio::test]
838841
async fn initial_status_is_idle_when_token_present() {
839-
let store = MockSecretStore::with_token("tok").as_arc_dyn();
842+
let store = MockSecretStore::with_token("tok").into_arc_dyn();
840843
let has_token = store.load_token("default").await.is_ok();
841844
let initial = if has_token {
842845
SyncStatus::Idle

0 commit comments

Comments
 (0)