Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obk
Type dependent defs wrappers First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR. Issue: https://github.com/rust-lang/rust/issues/59094 This PR adds 3 helper methods to `TypeckTables`: * `opt_type_dependent_def` * `opt_type_dependent_def_id` * `type_dependent_def_id` I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result. Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here? Sry it took me so long, as I said I'm new here and I had tough week :).
This commit is contained in:
commit
4720fcac4c
10 changed files with 24 additions and 19 deletions
|
|
@ -573,8 +573,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
|
|||
}
|
||||
ast::ExprKind::MethodCall(ref seg, ..) => {
|
||||
let expr_hir_id = self.tcx.hir().definitions().node_to_hir_id(expr.id);
|
||||
let method_id = match self.tables.type_dependent_defs().get(expr_hir_id) {
|
||||
Some(id) => id.def_id(),
|
||||
let method_id = match self.tables.type_dependent_def_id(expr_hir_id) {
|
||||
Some(id) => id,
|
||||
None => {
|
||||
debug!("Could not resolve method id for {:?}", expr);
|
||||
return None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue