use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs};
use rustc::bug;
+use rustc_ast::ast::*;
+use rustc_ast::attr;
+use rustc_ast::ptr::P as AstP;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::symbol::{sym, Symbol};
-use syntax::ast::*;
-use syntax::attr;
-use syntax::ptr::P as AstP;
impl<'hir> LoweringContext<'_, 'hir> {
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
e2: Option<&Expr>,
lims: RangeLimits,
) -> hir::ExprKind<'hir> {
- use syntax::ast::RangeLimits::*;
+ use rustc_ast::ast::RangeLimits::*;
let path = match (e1, e2, lims) {
(None, None, HalfOpen) => sym::RangeFull,
.last()
.cloned()
.map(|id| Ok(self.lower_node_id(id)))
- .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope))
- .into(),
+ .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope)),
};
hir::Destination { label: destination.map(|(_, label)| label), target_id }
}
if self.is_in_loop_condition && opt_label.is_none() {
hir::Destination {
label: None,
- target_id: Err(hir::LoopIdError::UnlabeledCfInWhileCondition).into(),
+ target_id: Err(hir::LoopIdError::UnlabeledCfInWhileCondition),
}
} else {
self.lower_loop_destination(opt_label.map(|label| (id, label)))
.collect(),
asm: asm.asm,
asm_str_style: asm.asm_str_style,
- clobbers: asm.clobbers.clone().into(),
+ clobbers: asm.clobbers.clone(),
volatile: asm.volatile,
alignstack: asm.alignstack,
dialect: asm.dialect,
let from_err_expr =
self.wrap_in_try_constructor(sym::from_error, unstable_span, from_expr, try_span);
let thin_attrs = ThinVec::from(attrs);
- let catch_scope = self.catch_scopes.last().map(|x| *x);
+ let catch_scope = self.catch_scopes.last().copied();
let ret_expr = if let Some(catch_node) = catch_scope {
let target_id = Ok(self.lower_node_id(catch_node));
self.arena.alloc(self.expr(