Skip to content

Commit

Permalink
Run cargo fmt on 1.72
Browse files Browse the repository at this point in the history
  • Loading branch information
HKalbasi committed Aug 25, 2023
1 parent 3864b43 commit fa76f60
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
6 changes: 5 additions & 1 deletion crates/hir-def/src/nameres/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-expand/src/builtin_fn_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-expand/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
12 changes: 9 additions & 3 deletions crates/hir-ty/src/infer/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
3 changes: 2 additions & 1 deletion crates/hir-ty/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};

Expand Down
4 changes: 3 additions & 1 deletion crates/hir-ty/src/mir/eval/shim/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
17 changes: 7 additions & 10 deletions crates/hir-ty/src/mir/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1259,7 +1260,8 @@ impl<'ctx> MirLowerCtx<'ctx> {
*expr,
rhs.project(ProjectionElem::TupleOrClosureField(i)),
span,
)? else {
)?
else {
return Ok(None);
};
current = c;
Expand All @@ -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);
};
Expand All @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit fa76f60

Please sign in to comment.