Skip to content

An else branch that only holds an if is written as an else-if - #590

Closed
lml2468 wants to merge 1 commit into
deeplethe:devfrom
lml2468:fix/an-else-that-only-holds-an-if-is-an-else-if
Closed

lml2468 wants to merge 1 commit into
deeplethe:devfrom
lml2468:fix/an-else-that-only-holds-an-if-is-an-else-if

Conversation

@lml2468

@lml2468 lml2468 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Corrected after checking CI — the original description of this PR had the motivation backwards. See the note below.

clippy::collapsible_else_if fires on two blocks in crates/utopia-store/src/temporal.rs under clippy 1.93.0:

error: this `else { if .. }` block can be collapsed
  --> crates/utopia-store/src/temporal.rs:124:24
  --> crates/utopia-store/src/temporal.rs:142:24

It does not fire on the toolchain CI actually runs (rustc 1.98.1, 2026-09-01) — #591, which carries the unmodified file, passes cargo clippy --workspace --all-targets -- -D warnings on your runners. So this is not a CI fix, and nothing on dev is red because of it.

What's left is a small readability change that some clippy versions ask for: an else whose whole body is one if reads as an else if. -18/+22, behaviour unchanged.

Entirely reasonable to close this as cosmetic churn — no argument from me if you'd rather not take it.

Checked locally (macOS, rustc 1.93.0):

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test -p utopia-store with UTOPIA_DATABASE_URL set — 178 passed, 0 failed

@lml2468

lml2468 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Correcting my own PR description before anyone spends review time on it.

I claimed this lint would turn CI red once runners picked up a newer stable. That's backwards. Your runners are already on rustc 1.98.1 and clippy there does not flag these blocks — #591 carries the unmodified temporal.rs and its Clippy step is green. The lint fired on my local 1.93.0, which is nine months behind.

So there is no CI breakage here, and the only thing this PR offers is the collapse itself. I've rewritten the description to say that. Happy to close it if it isn't worth the churn.

Signed-off-by: Menglin Li <limenglin5911@gmail.com>
@lml2468
lml2468 force-pushed the fix/an-else-that-only-holds-an-if-is-an-else-if branch from cadba42 to 5ddc284 Compare September 10, 2026 11:10
@lml2468

lml2468 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing this — as noted above, it isn't a CI fix: clippy on the toolchain your CI runs (1.98.1) doesn't flag these blocks, and the collapse on its own isn't worth the review time.

Leaving it here in case the lint comes back on a future stable. Sorry for the noise.

@lml2468 lml2468 closed this Sep 10, 2026
@lml2468
lml2468 deleted the fix/an-else-that-only-holds-an-if-is-an-else-if branch September 10, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant