Inline a single-use closure

This commit is contained in:
Dániel Buga 2020-12-20 23:17:56 +01:00
parent f499601dd8
commit 66c2872901

View File

@ -1771,7 +1771,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
path
);
let ns = source.namespace();
let is_expected = &|res| source.is_expected(res);
let report_errors = |this: &mut Self, res: Option<Res>| {
if this.should_report_errs() {
@ -1874,7 +1873,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
crate_lint,
) {
Ok(Some(partial_res)) if partial_res.unresolved_segments() == 0 => {
if is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err {
if source.is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err
{
partial_res
} else {
report_errors(self, Some(partial_res.base_res()))