diff --git a/src/string/formatter.cr b/src/string/formatter.cr index 0e96f05cb050..33d8872b3e5c 100644 --- a/src/string/formatter.cr +++ b/src/string/formatter.cr @@ -248,9 +248,10 @@ struct String::Formatter(A) end def char(flags, arg) : Nil - val = if arg.is_a?(Char) + val = case arg + when Char arg - elsif arg.is_a?(Int::Primitive) + when Int::Primitive arg.chr else raise ArgumentError.new("Expected a char or integer, not #{arg.inspect}")