Skip to content

Commit 1613ca5

Browse files
committed
Format
1 parent 98db404 commit 1613ca5

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

lib/advent_of_code.ex

+10-6
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ defmodule AdventOfCode do
1717
"""
1818
@spec solve(year(), day()) :: {any(), any()}
1919
def solve(year, day, rust? \\ false) do
20-
solution = :timer.tc(fn ->
21-
case rust? do
22-
true ->
20+
solution =
21+
:timer.tc(fn ->
22+
case rust? do
23+
true ->
2324
{_, result} = AdventOfCode.RustNif.solve(year, day)
2425
result
25-
false -> Module.concat([AdventOfCode, get_year_module(year), get_day_module(day)]).run()
26-
end
27-
end)
26+
27+
false ->
28+
Module.concat([AdventOfCode, get_year_module(year), get_day_module(day)]).run()
29+
end
30+
end)
31+
2832
{:ok, solution}
2933
rescue
3034
_ in FunctionClauseError -> {:error, :invalid_args}

lib/mix/tasks/solve.ex

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ defmodule Mix.Tasks.Solve do
1818
case InputParser.parse(args) do
1919
{year, day} ->
2020
case AdventOfCode.solve(year, day, false) do
21-
{:ok, {time, {part_1, part_2}}} -> Mix.shell().info("Part 1: #{part_1}\tPart 2: #{part_2}\tTime: #{time} µs")
22-
{:error, :not_yet_solved} -> Mix.shell().error("#{year}/#{day} is not solved yet")
23-
{:error, :invalid_args} -> Mix.shell().error("Invalid year/day: #{year}/#{day}")
21+
{:ok, {time, {part_1, part_2}}} ->
22+
Mix.shell().info("Part 1: #{part_1}\tPart 2: #{part_2}\tTime: #{time} µs")
23+
24+
{:error, :not_yet_solved} ->
25+
Mix.shell().error("#{year}/#{day} is not solved yet")
26+
27+
{:error, :invalid_args} ->
28+
Mix.shell().error("Invalid year/day: #{year}/#{day}")
2429
end
2530

2631
_ ->

0 commit comments

Comments
 (0)