Skip to main content

max / supernote-push

supernote-push: adopt universal clippy/lint baseline; warnings to zero #[must_use] on the Client builder setters; from_mdns keeps its by-value error param behind a documented #[allow(needless_pass_by_value)]. clippy --all-targets clean, cargo fmt clean, tests green (12 passed+0 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-23 13:14 UTC
Commit: b7c0f259532ec929432c1eb27d0f8815c3562ec2
Parent: 4974000
4 files changed, +39 insertions, -3 deletions
M Cargo.toml +32
@@ -15,3 +15,35 @@ serde = { version = "1", features = ["derive"] }
15 15 serde_json = "1"
16 16 thiserror = "2"
17 17 percent-encoding = "2"
18 +
19 + [lints.rust]
20 + unused = "warn"
21 + unreachable_pub = "warn"
22 +
23 + [lints.clippy]
24 + pedantic = { level = "warn", priority = -1 }
25 + # Allow-list tuned from a measured breakdown across server/multithreaded/pter
26 + # (2026-07-22). These are the high-churn / low-signal pedantic lints; everything
27 + # else in `pedantic` stays a warning. Keep this block identical across repos.
28 + module_name_repetitions = "allow"
29 + # Doc lints — no docs-completeness push underway.
30 + missing_errors_doc = "allow"
31 + missing_panics_doc = "allow"
32 + doc_markdown = "allow"
33 + # Numeric casts — endemic and mostly intentional in size/byte math.
34 + cast_possible_truncation = "allow"
35 + cast_sign_loss = "allow"
36 + cast_precision_loss = "allow"
37 + cast_possible_wrap = "allow"
38 + cast_lossless = "allow"
39 + # Subjective structure/style nags — high churn, low signal.
40 + must_use_candidate = "allow"
41 + too_many_lines = "allow"
42 + struct_excessive_bools = "allow"
43 + similar_names = "allow"
44 + items_after_statements = "allow"
45 + single_match_else = "allow"
46 + # Frequent false-positives in TUI/router-heavy code — added from the buckets breakdown.
47 + match_same_arms = "allow"
48 + unnecessary_wraps = "allow"
49 + type_complexity = "allow"
M src/browse.rs +2 -3
@@ -148,8 +148,7 @@ fn encode_multipart(filename: &str, content_type: &str, bytes: &[u8]) -> (Vec<u8
148 148 "----supernote-push-{}",
149 149 std::time::SystemTime::now()
150 150 .duration_since(std::time::UNIX_EPOCH)
151 - .map(|d| d.as_nanos())
152 - .unwrap_or(0)
151 + .map_or(0, |d| d.as_nanos())
153 152 );
154 153
155 154 let disposition = format!(
@@ -194,7 +193,7 @@ fn basic(passcode: &str) -> String {
194 193 mod base64_stub {
195 194 const TABLE: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
196 195
197 - pub fn encode(input: impl AsRef<[u8]>) -> String {
196 + pub(super) fn encode(input: impl AsRef<[u8]>) -> String {
198 197 let input = input.as_ref();
199 198 let mut out = String::with_capacity(input.len().div_ceil(3) * 4);
200 199 for chunk in input.chunks(3) {
@@ -34,16 +34,19 @@ impl Supernote {
34 34 }
35 35 }
36 36
37 + #[must_use]
37 38 pub fn with_port(mut self, port: u16) -> Self {
38 39 self.port = port;
39 40 self
40 41 }
41 42
43 + #[must_use]
42 44 pub fn with_passcode(mut self, passcode: impl Into<String>) -> Self {
43 45 self.passcode = Some(passcode.into());
44 46 self
45 47 }
46 48
49 + #[must_use]
47 50 pub fn with_timeout(mut self, timeout: Duration) -> Self {
48 51 self.timeout = timeout;
49 52 self
@@ -24,6 +24,8 @@ impl Error {
24 24 }
25 25 }
26 26
27 + // e is consumed into the stringified error variant.
28 + #[allow(clippy::needless_pass_by_value)]
27 29 pub(crate) fn from_mdns(e: mdns_sd::Error) -> Self {
28 30 Self::Mdns(e.to_string())
29 31 }