diff options
| author | hkalbasi <hamidrezakalbasi@protonmail.com> | 2023-08-25 18:08:36 +0330 |
|---|---|---|
| committer | hkalbasi <hamidrezakalbasi@protonmail.com> | 2023-08-25 22:24:41 +0330 |
| commit | fa76f60cc15bfee251366476b982e4f9a97e199a (patch) | |
| tree | 0965c2b8793d3ad96e0f5a3473f23e278bd2561c | |
| parent | 3864b43d2829b888f88d79892511f2feb0773b60 (diff) | |
| download | rust-fa76f60cc15bfee251366476b982e4f9a97e199a.tar.gz rust-fa76f60cc15bfee251366476b982e4f9a97e199a.zip | |
Run cargo fmt on 1.72
| -rw-r--r-- | crates/hir-def/src/nameres/collector.rs | 6 | ||||
| -rw-r--r-- | crates/hir-expand/src/builtin_fn_macro.rs | 2 | ||||
| -rw-r--r-- | crates/hir-expand/src/hygiene.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/infer/cast.rs | 12 | ||||
| -rw-r--r-- | crates/hir-ty/src/layout.rs | 3 | ||||
| -rw-r--r-- | crates/hir-ty/src/mir/eval/shim/simd.rs | 4 | ||||
| -rw-r--r-- | crates/hir-ty/src/mir/lower.rs | 17 |
7 files changed, 28 insertions, 18 deletions
diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs index e9e71a8747f..2d4586146db 100644 --- a/crates/hir-def/src/nameres/collector.rs +++ b/crates/hir-def/src/nameres/collector.rs @@ -1828,7 +1828,11 @@ impl ModCollector<'_, '_> { let Some(paths) = attr.parse_path_comma_token_tree(db.upcast(), &hygiene) else { // `#[macro_use]` (without any paths) found, forget collected names and just import // all visible macros. - self.def_collector.import_macros_from_extern_crate(target_crate, None, Some(extern_crate_id)); + self.def_collector.import_macros_from_extern_crate( + target_crate, + None, + Some(extern_crate_id), + ); return; }; for path in paths { diff --git a/crates/hir-expand/src/builtin_fn_macro.rs b/crates/hir-expand/src/builtin_fn_macro.rs index 95c6baf42da..6a48acef963 100644 --- a/crates/hir-expand/src/builtin_fn_macro.rs +++ b/crates/hir-expand/src/builtin_fn_macro.rs @@ -692,7 +692,7 @@ pub(crate) fn include_arg_to_tt( arg_id: MacroCallId, ) -> Result<(triomphe::Arc<(::tt::Subtree<::tt::TokenId>, TokenMap)>, FileId), ExpandError> { let loc = db.lookup_intern_macro_call(arg_id); - let Some(EagerCallInfo { arg,arg_id, .. }) = loc.eager.as_deref() else { + let Some(EagerCallInfo { arg, arg_id, .. }) = loc.eager.as_deref() else { panic!("include_arg_to_tt called on non include macro call: {:?}", &loc.eager); }; let path = parse_string(&arg.0)?; diff --git a/crates/hir-expand/src/hygiene.rs b/crates/hir-expand/src/hygiene.rs index ade4a592893..ca65db1136c 100644 --- a/crates/hir-expand/src/hygiene.rs +++ b/crates/hir-expand/src/hygiene.rs @@ -242,7 +242,7 @@ impl HygieneFrame { krate, call_site: None, def_site: None, - } + }; }; let def_site = info.attr_input_or_mac_def_start.map(|it| db.hygiene_frame(it.file_id)); diff --git a/crates/hir-ty/src/infer/cast.rs b/crates/hir-ty/src/infer/cast.rs index 9e1c74b16fa..a116d444731 100644 --- a/crates/hir-ty/src/infer/cast.rs +++ b/crates/hir-ty/src/infer/cast.rs @@ -39,8 +39,14 @@ impl CastCheck { } fn check_ref_to_ptr_cast(expr_ty: Ty, cast_ty: Ty, table: &mut InferenceTable<'_>) -> bool { - let Some((expr_inner_ty, _, _)) = expr_ty.as_reference() else { return false; }; - let Some((cast_inner_ty, _)) = cast_ty.as_raw_ptr() else { return false; }; - let TyKind::Array(expr_elt_ty, _) = expr_inner_ty.kind(Interner) else { return false; }; + let Some((expr_inner_ty, _, _)) = expr_ty.as_reference() else { + return false; + }; + let Some((cast_inner_ty, _)) = cast_ty.as_raw_ptr() else { + return false; + }; + let TyKind::Array(expr_elt_ty, _) = expr_inner_ty.kind(Interner) else { + return false; + }; table.coerce(expr_elt_ty, cast_inner_ty).is_ok() } diff --git a/crates/hir-ty/src/layout.rs b/crates/hir-ty/src/layout.rs index b15339d4434..714930ba667 100644 --- a/crates/hir-ty/src/layout.rs +++ b/crates/hir-ty/src/layout.rs @@ -109,7 +109,8 @@ fn layout_of_simd_ty( // * the homogeneous field type and the number of fields. let (e_ty, e_len, is_array) = if let TyKind::Array(e_ty, _) = f0_ty.kind(Interner) { // Extract the number of elements from the layout of the array field: - let FieldsShape::Array { count, .. } = db.layout_of_ty(f0_ty.clone(), env.clone())?.fields else { + let FieldsShape::Array { count, .. } = db.layout_of_ty(f0_ty.clone(), env.clone())?.fields + else { user_error!("Array with non array layout"); }; diff --git a/crates/hir-ty/src/mir/eval/shim/simd.rs b/crates/hir-ty/src/mir/eval/shim/simd.rs index ec746310487..51900662426 100644 --- a/crates/hir-ty/src/mir/eval/shim/simd.rs +++ b/crates/hir-ty/src/mir/eval/shim/simd.rs @@ -45,7 +45,9 @@ impl Evaluator<'_> { }; match try_const_usize(self.db, len) { Some(len) => { - let Some(ty) = subst.as_slice(Interner).get(0).and_then(|it| it.ty(Interner)) else { + let Some(ty) = + subst.as_slice(Interner).get(0).and_then(|it| it.ty(Interner)) + else { return Err(MirEvalError::TypeError("simd type with no ty param")); }; Ok((len as usize, ty.clone())) diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs index 51cf882d053..7c15aa42fd2 100644 --- a/crates/hir-ty/src/mir/lower.rs +++ b/crates/hir-ty/src/mir/lower.rs @@ -1201,7 +1201,8 @@ impl<'ctx> MirLowerCtx<'ctx> { let Some(values) = elements .iter() .map(|it| { - let Some((o, c)) = self.lower_expr_to_some_operand(*it, current)? else { + let Some((o, c)) = self.lower_expr_to_some_operand(*it, current)? + else { return Ok(None); }; current = c; @@ -1259,7 +1260,8 @@ impl<'ctx> MirLowerCtx<'ctx> { *expr, rhs.project(ProjectionElem::TupleOrClosureField(i)), span, - )? else { + )? + else { return Ok(None); }; current = c; @@ -1268,8 +1270,7 @@ impl<'ctx> MirLowerCtx<'ctx> { } Expr::Underscore => Ok(Some(current)), _ => { - let Some((lhs_place, current)) = - self.lower_expr_as_place(current, lhs, false)? + let Some((lhs_place, current)) = self.lower_expr_as_place(current, lhs, false)? else { return Ok(None); }; @@ -1286,9 +1287,7 @@ impl<'ctx> MirLowerCtx<'ctx> { rhs: ExprId, span: MirSpan, ) -> Result<Option<BasicBlockId>> { - let Some((rhs_op, current)) = - self.lower_expr_to_some_operand(rhs, current)? - else { + let Some((rhs_op, current)) = self.lower_expr_to_some_operand(rhs, current)? else { return Ok(None); }; if matches!(&self.body.exprs[lhs], Expr::Underscore) { @@ -1303,9 +1302,7 @@ impl<'ctx> MirLowerCtx<'ctx> { self.push_assignment(current, temp.clone(), rhs_op.into(), span); return self.lower_destructing_assignment(current, lhs, temp, span); } - let Some((lhs_place, current)) = - self.lower_expr_as_place(current, lhs, false)? - else { + let Some((lhs_place, current)) = self.lower_expr_as_place(current, lhs, false)? else { return Ok(None); }; self.push_assignment(current, lhs_place, rhs_op.into(), span); |
