diff options
| author | aur-build <aur-build@localhost> | 2026-11-22 10:36:24 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-22 10:36:24 +0000 |
| commit | 3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (patch) | |
| tree | 7cc7169181b4bdd73fd8817f8c1d7cce6e6998a8 /src/http/sse.rs | |
| parent | 9dc9087d89891c6e5ef7e5dc084dd13c8611843e (diff) | |
| download | aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.tar.gz aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.zip | |
rustfmt,lints: pin the formatting, adopt the idiom lints, pay them off
rustfmt.toml fixes the shape the tree is written in (120 columns, small
items kept on one line) and one canonical pass makes it the truth.
[lints.clippy] names the idiom lints worth enforcing and leaves out the
two that would add doc-comment boilerplate rather than remove it. The
tree pays them off here: write!/writeln! instead of push_str(&format!()),
let-else instead of match-on-Option, borrows where a thread entry point
only reads what it owns, no `&self` on a Copy state and no `self` nobody
reads.
ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and
value are now emitted by the same call instead of three.
Diffstat (limited to 'src/http/sse.rs')
| -rw-r--r-- | src/http/sse.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/http/sse.rs b/src/http/sse.rs index 03e09ff..36a9d42 100644 --- a/src/http/sse.rs +++ b/src/http/sse.rs @@ -13,7 +13,7 @@ const POLL: Duration = Duration::from_millis(200); /// only way to reach it, and the alias is what carries the /// feature-conditional visibility. mod log_tail { - use super::*; + use super::{builds, io, read_from, Duration, Instant, PathBuf, Read, KEEPALIVE, MAX_LIFETIME, POLL}; pub struct LogTail { path: PathBuf, @@ -120,13 +120,8 @@ pub use log_tail::LogTail; #[cfg(not(feature = "test-support"))] pub(crate) use log_tail::LogTail; - - fn read_from(path: &Path, offset: u64) -> (Vec<u8>, bool) { - let mut f = match std::fs::File::open(path) { - Ok(f) => f, - Err(_) => return (Vec::new(), false), - }; + let Ok(mut f) = std::fs::File::open(path) else { return (Vec::new(), false) }; use std::io::Seek; if f.seek(std::io::SeekFrom::Start(offset)).is_err() { return (Vec::new(), false); |
