Skip to content

Commit

Permalink
Replace panics with early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
JarredAllen committed Aug 12, 2020
1 parent 480ccc3 commit 4e28d99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clippy_lints/src/types.rs
Expand Up @@ -357,13 +357,13 @@ impl Types {
let box_ty = match &last_path_segment(qpath).args.unwrap().args[0] {
GenericArg::Type(ty) => match &ty.kind {
TyKind::Path(qpath) => qpath,
_ => panic!("Box that isn't a type"),
_ => return,
},
_ => panic!("Rc without type argument"),
_ => return,
};
let inner_span = match &last_path_segment(&box_ty).args.unwrap().args[0] {
GenericArg::Type(ty) => ty.span,
_ => panic!("Box without type argument"),
_ => return,
};
span_lint_and_sugg(
cx,
Expand Down

0 comments on commit 4e28d99

Please sign in to comment.