Simplify handling of visibility_scope
in declare_bindings
This avoids the need to unwrap an option after ensuring that it is some.
This commit is contained in:
parent
bca5f567d2
commit
977106a215
1 changed files with 4 additions and 6 deletions
|
@ -759,15 +759,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
pattern,
|
||||
UserTypeProjections::none(),
|
||||
&mut |this, name, mode, var, span, ty, user_ty| {
|
||||
if visibility_scope.is_none() {
|
||||
visibility_scope =
|
||||
Some(this.new_source_scope(scope_span, LintLevel::Inherited));
|
||||
}
|
||||
let vis_scope = *visibility_scope
|
||||
.get_or_insert_with(|| this.new_source_scope(scope_span, LintLevel::Inherited));
|
||||
let source_info = SourceInfo { span, scope: this.source_scope };
|
||||
let visibility_scope = visibility_scope.unwrap();
|
||||
|
||||
this.declare_binding(
|
||||
source_info,
|
||||
visibility_scope,
|
||||
vis_scope,
|
||||
name,
|
||||
mode,
|
||||
var,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue