diff --git a/samples/conway.cr b/samples/conway.cr index 5178d48f9bd0..c2d8c0bfa4eb 100644 --- a/samples/conway.cr +++ b/samples/conway.cr @@ -30,7 +30,7 @@ struct ConwayMap def initialize(pattern) @map = Array.new(HEIGHT) { Array.new(WIDTH, false) } - ix = min WIDTH, pattern.map(&.size).max + ix = min WIDTH, pattern.max_of(&.size) iy = min HEIGHT, pattern.size dx = (WIDTH - ix) // 2 dy = (HEIGHT - iy) // 2 diff --git a/src/compiler/crystal/codegen/primitives.cr b/src/compiler/crystal/codegen/primitives.cr index 19f827b8dd7a..7eedfdab4adf 100644 --- a/src/compiler/crystal/codegen/primitives.cr +++ b/src/compiler/crystal/codegen/primitives.cr @@ -166,7 +166,7 @@ class Crystal::CodeGenVisitor end calc_signed = t1.signed? || t2.signed? - calc_width = {t1, t2}.map { |t| t.bytes * 8 + ((calc_signed && t.unsigned?) ? 1 : 0) }.max + calc_width = {t1, t2}.max_of { |t| t.bytes * 8 + ((calc_signed && t.unsigned?) ? 1 : 0) } calc_type = llvm_context.int(calc_width) e1 = t1.signed? ? builder.sext(p1, calc_type) : builder.zext(p1, calc_type) diff --git a/src/compiler/crystal/tools/init.cr b/src/compiler/crystal/tools/init.cr index 01b2e137c578..32a6b5483de6 100644 --- a/src/compiler/crystal/tools/init.cr +++ b/src/compiler/crystal/tools/init.cr @@ -230,7 +230,7 @@ module Crystal def overwrite_checks(views) existing_views, new_views = views.partition(&.overwriting?) - if existing_views.any? && !config.skip_existing + if existing_views.present? && !config.skip_existing raise FilesConflictError.new existing_views.map(&.path) end