Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions arbiter-app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl ArbiterRollingWriter {
impl std::io::Write for ArbiterRollingWriter {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
let now = chrono::Local::now();
let filename = format!("arbiter.{}.log", now.format("%Y-%m-%d"));
let filename = format!("arbiter.{log_time}.log", log_time = now.format("%Y-%m-%d"));
let path = self.base_dir.join(filename);

if let Some(parent) = path.parent() {
Expand Down Expand Up @@ -85,8 +85,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
"
);
info!(
"Arbiter Engine: booting version {}",
env!("CARGO_PKG_VERSION")
"Arbiter Engine: booting version {version}",
version = env!("CARGO_PKG_VERSION")
);

let filter = ArbiterFilter::new();
Expand Down Expand Up @@ -210,10 +210,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
(1920, 1080)
}
};
info!(
"Runner: mapping display boundaries to {}x{}",
screen_width, screen_height
);
info!("Runner: mapping display boundaries to {screen_width}x{screen_height}",);
arbiter_bridge::runner::spawn(exec_cmd_rx, screen_width, screen_height, filter.clone());

// Signet config is loaded fresh on every execution via signet::load().
Expand Down
5 changes: 3 additions & 2 deletions arbiter-bridge/src/hand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ impl HardwareBridge {
fn validate_coordinate(&self, x: i32, y: i32) -> Result<(), String> {
if x < 0 || x > self.screen_width || y < 0 || y > self.screen_height {
let msg = format!(
"Hardware Guard: ({x}, {y}) outside monitor bounds ({}×{})",
self.screen_width, self.screen_height
"Hardware Guard: ({x}, {y}) outside monitor bounds ({w}x{h})",
w = self.screen_width,
h = self.screen_height
);
warn!(%msg, "Hand: coordinate rejected");
return Err(msg);
Expand Down
5 changes: 4 additions & 1 deletion arbiter-bridge/src/inscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ pub fn dry_run_walk(root: &Path, pattern: &str) -> DryRunReport {
let path_str = path.to_string_lossy().to_lowercase();

if path_str.contains("windows") || path_str.contains("system32") {
warnings.push(format!("System-critical path detected: {}", path.display()));
warnings.push(format!(
"System-critical path detected: {path_name}",
path_name = path.display()
));
}

debug!(path = %path.display(), "Dry-run: would affect");
Expand Down
6 changes: 3 additions & 3 deletions arbiter-bridge/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub fn spawn(

if let ActionType::Wait(ms) = action.action_type {
if dry_run {
info!("[DRY-RUN] Would wait for {} ms (execution bypassed)", ms);
info!("[DRY-RUN] Would wait for {ms} ms (execution bypassed)");
} else {
tokio::time::sleep(std::time::Duration::from_millis(ms)).await;
}
Expand Down Expand Up @@ -349,8 +349,8 @@ pub fn spawn(
error!(%e, id = %node.id, "Runner: action failed");
let _ = event_tx
.send(RunEvent::Panic(format!(
"Step '{}' failed: {}",
node.label, e
"Step '{label}' failed: {e}",
label = node.label
)))
.await;
break;
Expand Down
10 changes: 5 additions & 5 deletions arbiter-core/src/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl Atlas {
};

if !filename.is_empty() {
let path_prefix = format!("FileCreated|{}|", watch_path.display());
let path_prefix = format!("FileCreated|{path}|", path = watch_path.display());

for (reg_key, reg_ord) in &self.registry {
if reg_key.starts_with(&path_prefix) {
Expand Down Expand Up @@ -178,7 +178,7 @@ impl Atlas {
if self.state == EngineState::Idle {
return;
}
info!("Atlas: {}", reason);
info!("Atlas: {reason}");
if let Some(tx) = self.active_abort.take() {
let _ = tx.send(());
}
Expand Down Expand Up @@ -411,7 +411,7 @@ impl Atlas {
let _ = log_broadcast.send(LogEntry {
time: chrono::Utc::now().to_rfc3339(),
tag: "ATLAS".into(),
message: format!("Decree '{}' registered and saved.", def.label),
message: format!("Decree '{label}' registered and saved.", label = def.label),
is_error: false,
decree_id: Some(def.id.0.clone()),
});
Expand Down Expand Up @@ -446,7 +446,7 @@ impl Atlas {
let _ = log_broadcast.send(LogEntry {
time: chrono::Utc::now().to_rfc3339(),
tag: "VIGIL".into(),
message: format!("Conservatory Wards updated ({} active).", ledger.wards.len()),
message: format!("Conservatory Wards updated ({count} active).", count = ledger.wards.len()),
is_error: false,
decree_id: None,
});
Expand Down Expand Up @@ -503,7 +503,7 @@ impl Atlas {

let key = match removed.summons {
crate::ledger::SummonsDef::FileCreated { ward_id, pattern, .. } => {
format!("FileCreated|{}|{}", normalize_windows_path(&ward_id), pattern)
format!("FileCreated|{path}|{pattern}", path = normalize_windows_path(&ward_id))
}
crate::ledger::SummonsDef::Hotkey { combo } => format!("Hotkey|{combo}"),
crate::ledger::SummonsDef::ProcessAppeared { name } => format!("ProcessAppeared|{name}"),
Expand Down
8 changes: 4 additions & 4 deletions arbiter-core/src/decree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ impl<'de> serde::Deserialize<'de> for DecreeNode {
"Entry" => NodeState::Empty,
_ => {
return Err(serde::de::Error::custom(format!(
"Unknown node kind: {}",
raw.kind
"Unknown node kind: {kind}",
kind = raw.kind
)))
}
};
Expand Down Expand Up @@ -264,7 +264,7 @@ impl Summons {
watch_path,
pattern,
..
} => format!("FileCreated|{}|{}", watch_path.display(), pattern),
} => format!("FileCreated|{path}|{pattern}", path = watch_path.display()),
#[cfg(feature = "vigil-keys")]
Self::Hotkey { combo, .. } => format!("Hotkey|{combo}"),
#[cfg(feature = "vigil-clipboard")]
Expand Down Expand Up @@ -519,7 +519,7 @@ fn compute_sha256(path: &PathBuf) -> Option<String> {
hasher.update(&buffer[..n]);
}

Some(format!("{:x}", hasher.finalize()))
Some(format!("{hash:x}", hash = hasher.finalize()))
}

#[cfg(not(feature = "vigil-deep"))]
Expand Down
4 changes: 2 additions & 2 deletions arbiter-core/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ impl DecreeDef {
for (port, target_id) in &node.next_nodes {
if !node_ids.contains(target_id) {
return Err(format!(
"Node '{}' transition '{}' points to non-existent node '{}'",
node.label, port, target_id
"Node '{label}' transition '{port}' points to non-existent node '{target_id}'",
label = node.label
));
}
}
Expand Down
8 changes: 4 additions & 4 deletions arbiter-core/src/vigil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub mod fs {
};

let debounce_sig =
format!("{}|{}", summons.to_registry_key(), filename);
format!("{key}|{filename}", key = summons.to_registry_key());
let path_str_check = path_str.clone();

let tx_clone = tx.clone();
Expand Down Expand Up @@ -476,7 +476,7 @@ pub mod keys {
if let Some((combo, sum_tx)) = senders.get(&event.id) {
let mut context = super::EnvContext::new();
context.insert("hotkey_combo", combo);
context.insert("timestamp", &format!("{}", std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_secs()));
context.insert("timestamp", &format!("{secs}", secs = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_secs()));
context.insert("timestamp_local", &chrono::Local::now().format("%m/%d/%Y %I:%M %p").to_string());
let summons = super::Summons::Hotkey {
combo: combo.clone(),
Expand Down Expand Up @@ -607,8 +607,8 @@ pub mod clipboard {
context.insert(
"timestamp",
&format!(
"{}",
std::time::SystemTime::now()
"{secs}",
secs = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_secs()
Expand Down
4 changes: 2 additions & 2 deletions arbiter-core/src/vigil/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub fn spawn_watcher(
context.insert(
"timestamp",
&format!(
"{}",
std::time::SystemTime::now()
"{secs}",
secs = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_secs()
Expand Down
6 changes: 3 additions & 3 deletions arbiter-forge/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn generate_decree_id(label: &str) -> String {
.collect();

if slug.is_empty() {
format!("id-{}", CTR.fetch_add(1, Ordering::Relaxed))
format!("id-{id}", id = CTR.fetch_add(1, Ordering::Relaxed))
} else {
slug
}
Expand Down Expand Up @@ -202,7 +202,7 @@ fn next_new_decree_label() -> String {
}
}
});
format!("New Decree {}", max_n + 1)
format!("New Decree {n}", n = max_n + 1)
}

fn sync_ledger_to_ui() {
Expand Down Expand Up @@ -779,7 +779,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
{
use std::io::Write;
use std::process::{Command, Stdio};
info!("Copying to clipboard: {}", text);
info!("Copying to clipboard: {text}");
if let Ok(mut child) = Command::new("clip").stdin(Stdio::piped()).spawn() {
if let Some(mut stdin) = child.stdin.take() {
let _ = stdin.write_all(text.as_bytes());
Expand Down
Loading