Skip to content

Commit 070b3cc

Browse files
davidtwcoDavid Wood
authored andcommitted
replace remaining unwrap with except
`except`'s additional panic messages are helpful. Signed-off-by: David Wood <[email protected]>
1 parent f12e4f7 commit 070b3cc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

thorin/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ where
131131
};
132132

133133
let sess = self.sess;
134-
// UNWRAP: safe, created above
135-
self.maybe_in_progress.as_mut().unwrap().add_input_object(sess, obj, encoding)
134+
self.maybe_in_progress
135+
.as_mut()
136+
.expect("`process_input_object` is broken")
137+
.add_input_object(sess, obj, encoding)
136138
}
137139

138140
/// Add input objects referenced by executable to the DWARF package.

thorin/src/package.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ where
164164
R: gimli::Reader,
165165
Sess: Session<RelocationMap>,
166166
{
167-
// UNWRAP: `Index` types provided known to have `dwo_name` value.
168-
let index_name = Index::id().dwo_name().unwrap();
167+
let index_name = Index::id().dwo_name().expect("index id w/out known value");
169168
if let Some(index_section) = input.section_by_name(index_name) {
170169
let index_data = index_section
171170
.compressed_data()
@@ -312,8 +311,7 @@ macro_rules! generate_append_for {
312311
self.$name = Some(id);
313312
id
314313
} else {
315-
// UNWRAP: checked above
316-
self.$name.unwrap()
314+
self.$name.expect("`generate_append_for` is broken")
317315
};
318316

319317
// FIXME: correct alignment

0 commit comments

Comments
 (0)