Skip to content

Commit

Permalink
Fix clippy and rustfmt compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
eholk committed Sep 20, 2024
1 parent bd45002 commit 6988094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_utils/src/ast_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,8 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
(Slice(l), Slice(r)) => eq_ty(l, r),
(Array(le, ls), Array(re, rs)) => eq_ty(le, re) && eq_expr(&ls.value, &rs.value),
(Ptr(l), Ptr(r)) => l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty),
(Ref(ll, lp, l), Ref(rl, rp, r)) => {
both(ll, rl, |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty) && lp == rp
(Ref(ll, l), Ref(rl, r)) | (PinnedRef(ll, l), PinnedRef(rl, r)) => {
both(ll, rl, |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty)
},
(BareFn(l), BareFn(r)) => {
l.safety == r.safety
Expand Down
11 changes: 6 additions & 5 deletions src/tools/rustfmt/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,9 @@ impl Rewrite for ast::Ty {

rewrite_unary_prefix(context, prefix, &*mt.ty, shape)
}
ast::TyKind::Ref(ref lifetime, _pinned, ref mt) => {
// FIXME: format pinnedness
ast::TyKind::Ref(ref lifetime, ref mt)
| ast::TyKind::PinnedRef(ref lifetime, ref mt) => {
// FIXME(pin_ergonomics): correctly format pinned reference syntax
let mut_str = format_mutability(mt.mutbl);
let mut_len = mut_str.len();
let mut result = String::with_capacity(128);
Expand Down Expand Up @@ -1144,9 +1145,9 @@ pub(crate) fn can_be_overflowed_type(
) -> bool {
match ty.kind {
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
ast::TyKind::Ref(_, _, ref mutty) | ast::TyKind::Ptr(ref mutty) => {
can_be_overflowed_type(context, &*mutty.ty, len)
}
ast::TyKind::Ref(_, ref mutty)
| ast::TyKind::PinnedRef(_, ref mutty)
| ast::TyKind::Ptr(ref mutty) => can_be_overflowed_type(context, &*mutty.ty, len),
_ => false,
}
}
Expand Down

0 comments on commit 6988094

Please sign in to comment.