clippy::complexity fixes

clone_on_copy
useless_format
bind_instead_of_map
filter_map_identity
useless_conversion
map_flatten
unnecessary_unwrap
This commit is contained in:
Matthias Krüger 2022-05-26 13:14:24 +02:00
parent 8bf9c20765
commit 5fc8a8e227
11 changed files with 28 additions and 45 deletions

View file

@ -450,10 +450,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
_ => None,
};
if defined_hir.is_some() {
if let Some(def_hir) = defined_hir {
let upvars_map = self.infcx.tcx.upvars_mentioned(def_id).unwrap();
let upvar_def_span = self.infcx.tcx.hir().span(defined_hir.unwrap());
let upvar_span = upvars_map.get(&defined_hir.unwrap()).unwrap().span;
let upvar_def_span = self.infcx.tcx.hir().span(def_hir);
let upvar_span = upvars_map.get(&def_hir).unwrap().span;
diag.span_label(upvar_def_span, "variable defined here");
diag.span_label(upvar_span, "variable captured here");
}