review feedback: no reason to clone just to make a singleton slice.

This commit is contained in:
Felix S. Klock II 2018-07-26 22:48:56 +02:00
parent a0ac188220
commit 946264526c
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,8 @@ use rustc::mir::*;
use rustc::hir;
use syntax_pos::Span;
use std::slice;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
pub fn ast_block(&mut self,
destination: &Place<'tcx>,
@ -126,7 +128,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
None,
remainder_span,
lint_level,
&[pattern.clone()],
slice::from_ref(&pattern),
ArmHasGuard(false),
Some((None, initializer_span)),
);
@ -139,7 +141,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
}));
} else {
scope = this.declare_bindings(
None, remainder_span, lint_level, &[pattern.clone()],
None, remainder_span, lint_level, slice::from_ref(&pattern),
ArmHasGuard(false), None);
// FIXME(#47184): We currently only insert `UserAssertTy` statements for