Skip to content

Commit c61b6ef

Browse files
committed
transpile: rename fn literal_{kind_ => }matches_ty since we look at the value, too, now
1 parent ffa4f4c commit c61b6ef

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

c2rust-transpile/src/translator/literals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'c> Translation<'c> {
7171
}
7272

7373
/// Return whether the literal can be directly translated as this type.
74-
pub fn literal_kind_matches_ty(&self, lit: &CLiteral, ty: CQualTypeId) -> bool {
74+
pub fn literal_matches_ty(&self, lit: &CLiteral, ty: CQualTypeId) -> bool {
7575
let ty_kind = &self.ast_context.resolve_type(ty.ctype).kind;
7676
match *lit {
7777
CLiteral::Integer(value, _) if ty_kind.is_integral_type() && !ty_kind.is_bool() => {

c2rust-transpile/src/translator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3699,7 +3699,7 @@ impl<'c> Translation<'c> {
36993699
if let (Some(ty), CExprKind::Literal(_ty, lit)) =
37003700
(override_ty, &self.ast_context[expr].kind)
37013701
{
3702-
if self.literal_kind_matches_ty(lit, ty) {
3702+
if self.literal_matches_ty(lit, ty) {
37033703
return self.convert_expr(ctx, expr, override_ty);
37043704
}
37053705
}

0 commit comments

Comments
 (0)