Skip to main content

max / makeover-webview

Collapse the ghost-option guard into a let-chain
Author: Max Johnson <me@maxj.phd> · 2026-08-17 18:47 UTC
Commit: 0080aaf917c3de51d5bc3c814b97846d414c70c5
Parent: 1440f27
1 file changed, +6 insertions, -6 deletions
M src/form.rs +6 -6
@@ -404,12 +404,12 @@
404 404 // list once the field is answered. A non-empty value no option carries is a
405 405 // wrong answer rather than an absent one and takes the stray-option path
406 406 // below.
407 - if value.is_empty() {
408 - if let Some(text) = field.placeholder {
409 - out.push_str("<option value=\"\" disabled selected>");
410 - escape_into(text, out);
411 - out.push_str("</option>");
412 - }
407 + if value.is_empty()
408 + && let Some(text) = field.placeholder
409 + {
410 + out.push_str("<option value=\"\" disabled selected>");
411 + escape_into(text, out);
412 + out.push_str("</option>");
413 413 }
414 414 if !value.is_empty() && !options.iter().any(|opt| opt.value == value) {
415 415 // The one place an escaped value is worth keeping: it is written twice,