Skip to content

Commit

Permalink
Rollup merge of #69727 - JohnTitor:sugg-unwrap, r=estebank
Browse files Browse the repository at this point in the history
Avoid using `unwrap()` in suggestions

Addresses #69725, still need a regression test.

r? @estebank
  • Loading branch information
Centril authored Mar 6, 2020
2 parents b059d02 + 8efb9eb commit 7f53c32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
(&self_ty.kind, parent_pred)
{
if let ty::Adt(def, _) = p.skip_binder().trait_ref.self_ty().kind {
let id = self.tcx.hir().as_local_hir_id(def.did).unwrap();
let node = self.tcx.hir().get(id);
let node = self
.tcx
.hir()
.as_local_hir_id(def.did)
.map(|id| self.tcx.hir().get(id));
match node {
hir::Node::Item(hir::Item { kind, .. }) => {
Some(hir::Node::Item(hir::Item { kind, .. })) => {
if let Some(g) = kind.generics() {
let key = match &g.where_clause.predicates[..] {
[.., pred] => {
Expand Down

0 comments on commit 7f53c32

Please sign in to comment.