fix(lading): surface user-config parsing failures as Error variants#1902
Draft
goxberry wants to merge 1 commit into
Draft
Conversation
Convert five FIXME .expect() sites that panicked on malformed user-supplied YAML config into proper Error-variant propagation: - tcp.rs::Tcp::new: AddrParse + EmptyAddrResolution for to_socket_addrs - udp.rs::Udp::new: AddrParse + EmptyAddrResolution for to_socket_addrs - tcp_rr.rs::TcpRr::spin: InvalidAddr wrapping std::net::AddrParseError - grpc.rs::Grpc::new: InvalidTargetUri covering both URI parse and missing path-and-query - payloadtool.rs::check_generator: anyhow!() on zero maximum_prebuild_cache_size_bytes (eight identical sites) All five functions already returned Result. After conversion the fn-level #[expect(clippy::expect_used, reason = "FIXME: ...")] attributes are dropped since no .expect() calls remain in these functions. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This was referenced May 23, 2026
Contributor
Author
This was referenced May 23, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
First PR in a three-part follow-up to the
lading-crateexpect_usedcleanup stack (#1896–#1901). Each of the 10 sites annotated with
#[expect(clippy::expect_used, reason = "FIXME: …")]in that stackgets converted into a proper
Errorvariant in one of three PRs,grouped by failure mode.
This PR addresses the 5 user-supplied config sites — fields read out
of YAML at startup, where a malformed value should surface as a typed
error from the generator constructor rather than abort the process.
generator/tcp.rsTcp::newaddr lookupAddrParse { addr, source }+EmptyAddrResolution(String);?generator/udp.rsUdp::newaddr lookupudp::Error;?generator/tcp_rr.rsTcpRr::spinaddrInvalidAddr(#[from] AddrParseError);?generator/grpc.rsGrpc::newURI + pathInvalidTargetUri { uri, reason }covering both Uri parse and missing path;?bin/payloadtool.rscheck_generatorzero cacheanyhow::bail!(bin uses anyhow)The fn-level
#[expect(clippy::expect_used)]attribute is removedfrom each of the five functions; no other
.expect()calls remain intheir bodies.
Test plan
./ci/validatepassesgrep -n 'FIXME' lading/src/generator/{tcp,udp,tcp_rr,grpc}.rs lading/src/bin/payloadtool.rsis emptycargo build --workspace --all-targets --all-features🤖 Generated with Claude Code