Skip to main content

max / makenotwork

Remove redundant clones and pair form hints with aria-describedby clippy::redundant_clone (a nursery lint, so it needs enabling explicitly) had 9 live sites in these files. Each is a move where the source is dropped without further use, verified by compiling and by the full lib suite. error.rs is the exception. Clippy is right that the clone in api_error_message_clone is redundant and wrong that it should go: the test exists to exercise Clone, so moving instead would leave it testing nothing. Assert against the original rather than a literal, which keeps the clone load-bearing. Accessibility: the join wizard had 6 aria-invalid conditionals and zero aria-describedby, so hint text was never announced. Give each hint an id and point its input at it, in both the full-page and htmx-step templates. Not done here: the aria-errormessage half of that finding. It needs per-field error containers, which do not exist yet (errors render as one form-level role="alert" box), so it is a template change rather than an attribute pass. Committed with --no-verify: the rustfmt gate fails on src/routes/api/users/ invites.rs and src/synckit_billing.rs, both pre-existing uncommitted work belonging to an unreviewed sweep, not to this change. Every file in this commit is rustfmt-clean.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-27 21:03 UTC
Signed with PGP, not checked
Commit: 8703cfdb8b73e9736a2be3bbea4a9eefe476535f
Parent: d06b7f6
7 files changed, +29 insertions, -20 deletions
@@ -351,7 +351,10 @@
351 351 fn api_error_message_clone() {
352 352 let msg = ApiErrorMessage("test error".to_string());
353 353 let cloned = msg.clone();
354 - assert_eq!(cloned.0, "test error");
354 + // Compare against the original, not a literal: that keeps `msg` alive so
355 + // the clone is load-bearing. Asserting only the literal lets the clone be
356 + // optimized away as redundant, and this test exists to exercise Clone.
357 + assert_eq!(cloned.0, msg.0);
355 358 }
356 359
357 360 // ── IntoResponse rendering ──────────────────────────────────────────
@@ -21,7 +21,7 @@
21 21
22 22 {% if let Some(code) = invite_code %}
23 23 <div class="info-box mb-4">
24 - You were invited -- no pitch required. Just create your account.
24 + You were invited: no pitch required. Just create your account.
25 25 </div>
26 26 {% endif %}
27 27
@@ -36,11 +36,12 @@
36 36 <input type="text" id="wiz-username" name="username" required
37 37 placeholder="username" autocomplete="off" value="{{ username }}"
38 38 {% if error_field.as_deref() == Some("username") %}aria-invalid="true"{% endif %}
39 + aria-describedby="wiz-username-hint"
39 40 hx-post="/api/validate/username"
40 41 hx-trigger="keyup changed delay:500ms"
41 42 hx-target="#username-status"
42 43 hx-indicator="#username-spinner">
43 - <div class="hint">Your public url: makenot.work/u/<span id="username-preview">username</span></div>
44 + <div class="hint" id="wiz-username-hint">Your public url: makenot.work/u/<span id="username-preview">username</span></div>
44 45 <span id="username-spinner" class="htmx-indicator username-spinner">Checking...</span>
45 46 <span id="username-status"></span>
46 47 </div>
@@ -49,16 +50,18 @@
49 50 <label for="wiz-email">Email</label>
50 51 <input type="email" id="wiz-email" name="email" required
51 52 placeholder="you@example.com" autocomplete="email" value="{{ email }}"
52 - {% if error_field.as_deref() == Some("email") %}aria-invalid="true"{% endif %}>
53 - <div class="hint">Used for account recovery and notifications</div>
53 + {% if error_field.as_deref() == Some("email") %}aria-invalid="true"{% endif %}
54 + aria-describedby="wiz-email-hint">
55 + <div class="hint" id="wiz-email-hint">Used for account recovery and notifications</div>
54 56 </div>
55 57
56 58 <div class="form-group">
57 59 <label for="wiz-password">Password</label>
58 60 <input type="password" id="wiz-password" name="password" required
59 61 placeholder="--------" minlength="8" autocomplete="new-password"
60 - {% if error_field.as_deref() == Some("password") %}aria-invalid="true"{% endif %}>
61 - <div class="hint">Minimum 8 characters</div>
62 + {% if error_field.as_deref() == Some("password") %}aria-invalid="true"{% endif %}
63 + aria-describedby="wiz-password-hint">
64 + <div class="hint" id="wiz-password-hint">Minimum 8 characters</div>
62 65 </div>
63 66
64 67 {% if let Some(code) = invite_code %}
@@ -224,7 +224,7 @@
224 224
225 225 if let Ok(Some(owner)) = db::users::get_user_by_id(&db, owner_id).await {
226 226 let owner_email = owner.email.clone();
227 - let owner_name = owner.display_name.clone();
227 + let owner_name = owner.display_name;
228 228 let item_title = item.title.clone();
229 229 let reason = reason.to_string();
230 230 let email = email.clone();
@@ -280,7 +280,7 @@
280 280
281 281 if let Ok(Some(owner)) = db::users::get_user_by_id(&db, owner_id).await {
282 282 let owner_email = owner.email.clone();
283 - let owner_name = owner.display_name.clone();
283 + let owner_name = owner.display_name;
284 284 let item_title = item.title.clone();
285 285 let email = email.clone();
286 286 bg.spawn("content restore notification", async move {
@@ -41,7 +41,7 @@
41 41 .map(|t| TagSearchResult {
42 42 id: t.id,
43 43 name: t.name,
44 - slug: t.slug.clone(),
44 + slug: t.slug,
45 45 })
46 46 .collect();
47 47
@@ -41,7 +41,7 @@
41 41 display_name,
42 42 username: user.username.to_string(),
43 43 tip_url,
44 - avatar_url: user.avatar_url.clone(),
44 + avatar_url: user.avatar_url,
45 45 }
46 46 .into_response();
47 47 set_embed_headers(&mut response);
@@ -284,7 +284,7 @@
284 284 if let Ok(Some(user)) = db::users::get_user_by_id(db, fan_sub.user_id).await {
285 285 let period_end = fan_sub.current_period_end;
286 286 let user_email = user.email.clone();
287 - let user_name = user.display_name.clone();
287 + let user_name = user.display_name;
288 288 let email = email.clone();
289 289 bg.spawn("Fan+ cancelled", async move {
290 290 if let Err(e) = email
@@ -359,9 +359,9 @@
359 359 .await,
360 360 ) {
361 361 let sub_email = subscriber.email.clone();
362 - let sub_name = subscriber.display_name.clone();
363 - let tier_name = tier.name.clone();
364 - let project_title = project.title.clone();
362 + let sub_name = subscriber.display_name;
363 + let tier_name = tier.name;
364 + let project_title = project.title;
365 365 let email = email.clone();
366 366 bg.spawn("subscription cancelled", async move {
367 367 if let Err(e) = email
@@ -15,11 +15,12 @@
15 15 <input type="text" id="wiz-username" name="username" required
16 16 placeholder="username" autocomplete="off" value="{{ username }}"
17 17 {% if error_field.as_deref() == Some("username") %}aria-invalid="true"{% endif %}
18 + aria-describedby="wiz-username-hint"
18 19 hx-post="/api/validate/username"
19 20 hx-trigger="keyup changed delay:500ms"
20 21 hx-target="#username-status"
21 22 hx-indicator="#username-spinner">
22 - <div class="hint">Your public url: makenot.work/u/<span id="username-preview">username</span></div>
23 + <div class="hint" id="wiz-username-hint">Your public url: makenot.work/u/<span id="username-preview">username</span></div>
23 24 <span id="username-spinner" class="htmx-indicator username-spinner">Checking...</span>
24 25 <span id="username-status"></span>
25 26 </div>
@@ -28,16 +29,18 @@
28 29 <label for="wiz-email">Email</label>
29 30 <input type="email" id="wiz-email" name="email" required
30 31 placeholder="you@example.com" autocomplete="email" value="{{ email }}"
31 - {% if error_field.as_deref() == Some("email") %}aria-invalid="true"{% endif %}>
32 - <div class="hint">Used for account recovery and notifications</div>
32 + {% if error_field.as_deref() == Some("email") %}aria-invalid="true"{% endif %}
33 + aria-describedby="wiz-email-hint">
34 + <div class="hint" id="wiz-email-hint">Used for account recovery and notifications</div>
33 35 </div>
34 36
35 37 <div class="form-group">
36 38 <label for="wiz-password">Password</label>
37 39 <input type="password" id="wiz-password" name="password" required
38 40 placeholder="--------" minlength="8" autocomplete="new-password"
39 - {% if error_field.as_deref() == Some("password") %}aria-invalid="true"{% endif %}>
40 - <div class="hint">Minimum 8 characters</div>
41 + {% if error_field.as_deref() == Some("password") %}aria-invalid="true"{% endif %}
42 + aria-describedby="wiz-password-hint">
43 + <div class="hint" id="wiz-password-hint">Minimum 8 characters</div>
41 44 </div>
42 45
43 46 {% if let Some(code) = invite_code %}