tests: replace many .unwrap()s with ?s using eyre#9111
tests: replace many .unwrap()s with ?s using eyre#9111glehmann wants to merge 7 commits intojj-vcs:mainfrom
Conversation
…Result from parent commit This commit should be comparable with jj-vcs#9050 As of this writing, this replaced all but out of 1053 instances of `.block().unwrap()`. The remaining ones (as counted by AI): ``` ┌──────────────────┬───────┬────────────────────────────────────────────────────┐ │ Category │ Count │ Could convert? │ ├──────────────────┼───────┼────────────────────────────────────────────────────┤ │ testutils │ 20 │ No — return concrete types, would cascade to │ │ helpers │ │ hundreds of callers across all test files │ ├──────────────────┼───────┼────────────────────────────────────────────────────┤ │ Closures │ 53 │ No — closures return () or concrete values │ ├──────────────────┼───────┼────────────────────────────────────────────────────┤ │ Test helpers │ 22 │ Technically yes, but adds ~70 ? at call sites to │ │ │ │ save 22 unwraps │ ├──────────────────┼───────┼────────────────────────────────────────────────────┤ │ Non-convertible │ 4 │ No — CommandError (2), Pin<Box<dyn Future>> (1), │ │ │ │ closure in test_matrix (1) │ └──────────────────┴───────┴────────────────────────────────────────────────────┘ ```
|
Thanks for looking at this! Have you tested what the backtraces look like? My understanding is that colored-eyre's backtraces will look like the version of panic backtraces you get with That's the issue that turned that pr into a bit of a headache. |
|
Another reason I was doubtful about this approach is the need to either "install" colored-eyre in every test or use the ctor crate. ctor's docs make it seem a bit questionable. Also I'm not sure whether this installing affects just the panic handler, or whether it also allows backtraces when you use |
There was a problem hiding this comment.
The following commits do not follow our format for subject lines:
Commits should have a subject line following the format <topic>: <description>. Please review the commit guidelines for more information.
Filter backtrace frames to show only project code (jj_lib and jj_cli), removing noise from dependencies and standard library to make error reports easier to read during testing. Also enable backtrace capture by default (RUST_LIB_BACKTRACE=1) in tests so backtraces are shown without requiring the environment variable.
… in tests So backtraces are shown without requiring the environment variable.
3771490 to
0e3b5ad
Compare
All commits are now correctly formatted. Thank you for your contribution!




Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,demos/)cli/src/config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.