Skip to content

Commit b2811d6

Browse files
committed
cargo fmt
1 parent 2c95923 commit b2811d6

6 files changed

Lines changed: 22 additions & 23 deletions

File tree

src-tauri/src/audio.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ impl RmsWindow {
3535
}
3636
if self.count >= self.target_samples {
3737
let rms = (self.sum_sq / self.count as f64).sqrt();
38-
tracing::info!(rms = format!("{rms:.4}"), samples = self.count, "audio: 1s RMS");
38+
tracing::info!(
39+
rms = format!("{rms:.4}"),
40+
samples = self.count,
41+
"audio: 1s RMS"
42+
);
3943
self.sum_sq = 0.0;
4044
self.count = 0;
4145
}

src-tauri/src/bin/portal_test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ async fn main() -> ashpd::Result<()> {
4848
let session = proxy.create_session().await?;
4949

5050
let shortcuts = [
51-
NewShortcut::new(SHORTCUT_ID, "Toggle qol dictation")
52-
.preferred_trigger("CTRL+ALT+space"),
51+
NewShortcut::new(SHORTCUT_ID, "Toggle qol dictation").preferred_trigger("CTRL+ALT+space")
5352
];
5453

5554
println!(
@@ -60,7 +59,10 @@ async fn main() -> ashpd::Result<()> {
6059
.bind_shortcuts(&session, &shortcuts, None)
6160
.await?
6261
.response()?;
63-
println!("Bind OK. Portal accepted {} shortcut(s):", bind.shortcuts().len());
62+
println!(
63+
"Bind OK. Portal accepted {} shortcut(s):",
64+
bind.shortcuts().len()
65+
);
6466
for s in bind.shortcuts() {
6567
println!(
6668
" - id={:?} description={:?} trigger={:?}",

src-tauri/src/inject.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ fn run_ydotool(rx: mpsc::Receiver<InjectCmd>, ready_tx: mpsc::Sender<Result<(),
211211
InjectCmd::Type { text, .. } => ydotool_type(&text),
212212
InjectCmd::Backspace(n) => ydotool_key_repeat("14:1 14:0", n),
213213
InjectCmd::Newline => ydotool_key("28:1 28:0"),
214-
InjectCmd::Paragraph => {
215-
ydotool_key("28:1 28:0").and_then(|_| ydotool_key("28:1 28:0"))
216-
}
214+
InjectCmd::Paragraph => ydotool_key("28:1 28:0").and_then(|_| ydotool_key("28:1 28:0")),
217215
InjectCmd::SelectAll => ydotool_key("29:1 30:1 30:0 29:0"),
218216
};
219217
if let Err(e) = result {

src-tauri/src/polish.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,12 @@ mod tests {
336336
per_app_tone: true,
337337
};
338338
let ctx = PolishContext::new();
339-
let out = tokio::runtime::Runtime::new()
340-
.unwrap()
341-
.block_on(polish(&cfg, "raw text here", None, &ctx));
339+
let out = tokio::runtime::Runtime::new().unwrap().block_on(polish(
340+
&cfg,
341+
"raw text here",
342+
None,
343+
&ctx,
344+
));
342345
assert_eq!(out, "raw text here");
343346
assert!(ctx.snapshot().is_empty());
344347
}

src-tauri/src/session.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@ impl Session {
5757
}
5858
match parse_command(&raw) {
5959
Command::Text(text) => {
60-
let polished = polish(
61-
&polish_cfg,
62-
&text,
63-
app_for_polish.as_deref(),
64-
&polish_ctx,
65-
)
66-
.await;
60+
let polished =
61+
polish(&polish_cfg, &text, app_for_polish.as_deref(), &polish_ctx)
62+
.await;
6763
let normalized = polished.trim().to_string();
6864
if last_polished.as_deref() == Some(normalized.as_str()) {
6965
tracing::debug!(text = %normalized, "skipping duplicate segment");

src-tauri/src/trigger.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ pub async fn run<C: DictationControl>(control: std::sync::Arc<C>) -> Result<()>
124124
}
125125
}
126126

127-
let listener = UnixListener::bind(&path)
128-
.with_context(|| format!("bind {}", path.display()))?;
127+
let listener = UnixListener::bind(&path).with_context(|| format!("bind {}", path.display()))?;
129128
// Owner-only access. The socket lives in $XDG_RUNTIME_DIR which is
130129
// already 0700, so this is defense-in-depth.
131130
use std::os::unix::fs::PermissionsExt;
@@ -271,10 +270,7 @@ mod tests {
271270
#[tokio::test(flavor = "current_thread")]
272271
async fn toggle_flips_state() {
273272
let ctrl = Arc::new(FakeControl::default());
274-
let path = std::env::temp_dir().join(format!(
275-
"qol-test-{}.sock",
276-
std::process::id()
277-
));
273+
let path = std::env::temp_dir().join(format!("qol-test-{}.sock", std::process::id()));
278274
// Wire up listener manually since spawn() reads env vars.
279275
let _ = std::fs::remove_file(&path);
280276
let listener = UnixListener::bind(&path).unwrap();

0 commit comments

Comments
 (0)