]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_ast_lowering/expr.rs
Auto merge of #69076 - cjgillot:split_trait, r=matthewjasper
[rust.git] / src / librustc_ast_lowering / expr.rs
index e2dd55b4cbac2655286e6e9b6f9b55b6dbb2e2c9..7038387caa9bfb8e8b0787d22223c4d9c897e9cc 100644 (file)
@@ -1,15 +1,15 @@
 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>] {
@@ -783,7 +783,7 @@ fn lower_expr_range(
         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,
@@ -831,8 +831,7 @@ fn lower_loop_destination(&mut self, destination: Option<(NodeId, Label)>) -> hi
                 .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 }
     }
@@ -841,7 +840,7 @@ fn lower_jump_destination(&mut self, id: NodeId, opt_label: Option<Label>) -> hi
         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)))
@@ -912,7 +911,7 @@ fn lower_expr_asm(&mut self, asm: &InlineAsm) -> hir::ExprKind<'hir> {
                 .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,
@@ -1180,7 +1179,7 @@ fn lower_expr_try(&mut self, span: Span, sub_expr: &Expr) -> hir::ExprKind<'hir>
             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(