Watch
1
0
Fork
You've already forked souveraine
0

ci: restore strict clippy gate

This commit is contained in:
Fimeg 2026-07-12 21:38:16 -04:00
commit 29e204e56e
6 changed files with 17 additions and 20 deletions

View file

@ -78,6 +78,7 @@ impl ClaudeSubscriptionProvider {
/// Build from a provider config entry. Reads `~/.claude/.credentials.json`
/// (or the `credential_file` override), fetches `account_uuid` best-effort,
/// and persists a device id.
#[allow(clippy::too_many_arguments)]
pub fn new(
name: &str,
base_url: &str,
@ -104,7 +105,7 @@ impl ClaudeSubscriptionProvider {
let cred_path = resolve_credential_path(credential_file).context(
"no Claude Code credential file found (set credential_file or log in with `claude`)",
)?;
let mut token = load_credentials(&cred_path).with_context(|| {
let token = load_credentials(&cred_path).with_context(|| {
format!(
"failed to read Claude Code credentials at {}",
cred_path.display()
@ -188,10 +189,10 @@ impl ClaudeSubscriptionProvider {
/// missing or inside the proactive window.
async fn current_access_token(&self) -> Result<String> {
let mut token = self.token.lock().await;
let access_empty = token.access_token.as_deref().map_or(true, str::is_empty);
let access_empty = token.access_token.as_deref().is_none_or(str::is_empty);
let expiring = token
.expires_at_ms
.map_or(true, |exp| exp <= now_ms() + TOKEN_REFRESH_BUFFER.as_millis() as u64);
.is_none_or(|exp| exp <= now_ms() + TOKEN_REFRESH_BUFFER.as_millis() as u64);
if access_empty || expiring {
if let Err(e) = refresh_token(&self.http, &self.user_agent, &mut token).await {
warn!("claude token refresh failed: {e}");
@ -806,7 +807,7 @@ fn get_or_create_device_id() -> Result<String> {
let state_dir = match std::env::var("SOUVERAINE_STATE_DIR") {
Ok(v) => PathBuf::from(v),
Err(_) => dirs::state_dir()
.or_else(|| dirs::home_dir())
.or_else(dirs::home_dir)
.unwrap_or_else(|| PathBuf::from("."))
.join("souveraine"),
};

View file

@ -5,6 +5,11 @@
//! selecting a commissioning authority, a RedFlag integration, or a token
//! format.
// Commissioning records are intentionally staged ahead of the enrolment CLI
// and federation transport. Keep this public model lint-clean while those
// callers land in the next implementation phase.
#![allow(dead_code)]
use chrono::{DateTime, Utc};
use ed25519_dalek::Signature;
use serde::{Deserialize, Serialize};

View file

@ -191,15 +191,9 @@ pub fn load(dynamic_dir: &Path) -> Option<Itinerary> {
if t.exists() { Some(t) } else { None }
});
let body = if let Some(rest) = content.strip_prefix("---\n") {
if let Some(end) = rest.find("\n---\n") {
&rest[..end]
} else {
return None;
}
} else {
return None;
};
let rest = content.strip_prefix("---\n")?;
let end = rest.find("\n---\n")?;
let body = &rest[..end];
let mut ity: Itinerary = serde_yaml::from_str(body).ok()?;
enrich_from_todos(&mut ity, tasks_dir.as_deref());

View file

@ -130,7 +130,7 @@ pub(crate) async fn run_turn(
for b in &m.blocks {
match b {
ContentBlock::Text { text } => text_parts.push(text.as_str()),
ContentBlock::Image { media_type: _, .. } => {
ContentBlock::Image { .. } => {
text_parts.push("");
}
_ => {}

View file

@ -643,7 +643,7 @@ fn render_edit_body(
let mut lines: Vec<Line<'static>> = Vec::new();
// Header with path
let header = format!("┌─ edit{} ", if path.is_empty() { "" } else { ":" });
let label = format!("{}{}", header, &path);
let label = format!("{}{}", header, path);
let dashes = inner_width.saturating_sub(label.chars().count());
lines.push(Line::from(Span::styled(
format!("{}{}", label, "─".repeat(dashes)),

View file

@ -106,11 +106,8 @@ fn fuzzy_score(query: &str, path: &str) -> Option<i32> {
let mut score = 0i32;
for tok in &tokens {
if let Some(pos) = p.find(tok) {
score += 100 - pos as i32;
} else {
return None;
}
let pos = p.find(tok)?;
score += 100 - pos as i32;
}
score -= path.len() as i32 / 4;
Some(score)