aboutsummaryrefslogtreecommitdiff
path: root/gen
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-03-12 22:57:06 +0000
committerLouis Pilfold <louis@lpil.uk>2019-03-12 23:00:55 +0000
commit1ce9a14ba69c593bb40998a5a49d3f066a4aa07a (patch)
tree0a2767779f94f7f81738c6b35a2499e36718c736 /gen
parentd445ce0d0c57f1acbc33e081c015750c78401067 (diff)
downloadgleam_stdlib-1ce9a14ba69c593bb40998a5a49d3f066a4aa07a.tar.gz
gleam_stdlib-1ce9a14ba69c593bb40998a5a49d3f066a4aa07a.zip
Remove unnecessary `let _ =` from Gleam
Diffstat (limited to 'gen')
-rw-r--r--gen/bool.erl14
-rw-r--r--gen/list.erl34
-rw-r--r--gen/map.erl20
-rw-r--r--gen/order.erl56
-rw-r--r--gen/result.erl20
5 files changed, 69 insertions, 75 deletions
diff --git a/gen/bool.erl b/gen/bool.erl
index 8b9c1c4..01c81ce 100644
--- a/gen/bool.erl
+++ b/gen/bool.erl
@@ -15,9 +15,9 @@ max(A, B) ->
-ifdef(TEST).
max_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, true)),
- _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, false)),
- _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(max(false, false)),
+ (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, true)),
+ (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, false)),
+ (fun(Capture1) -> expect:equal(Capture1, false) end)(max(false, false)),
(fun(Capture1) -> expect:equal(Capture1, true) end)(max(false, true)).
-endif.
@@ -32,9 +32,9 @@ min(A, B) ->
-ifdef(TEST).
min_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(min(true, true)),
- _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(min(true, false)),
- _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(min(false, false)),
+ (fun(Capture1) -> expect:equal(Capture1, true) end)(min(true, true)),
+ (fun(Capture1) -> expect:equal(Capture1, false) end)(min(true, false)),
+ (fun(Capture1) -> expect:equal(Capture1, false) end)(min(false, false)),
(fun(Capture1) -> expect:equal(Capture1, false) end)(min(false, true)).
-endif.
@@ -49,6 +49,6 @@ to_int(Bool) ->
-ifdef(TEST).
to_int_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, 1) end)(to_int(true)),
+ (fun(Capture1) -> expect:equal(Capture1, 1) end)(to_int(true)),
(fun(Capture1) -> expect:equal(Capture1, 0) end)(to_int(false)).
-endif.
diff --git a/gen/list.erl b/gen/list.erl
index 7364f66..3155824 100644
--- a/gen/list.erl
+++ b/gen/list.erl
@@ -9,9 +9,9 @@ length(A) ->
-ifdef(TEST).
length_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, 0) end)(length([])),
- _ = (fun(Capture1) -> expect:equal(Capture1, 1) end)(length([1])),
- _ = (fun(Capture1) -> expect:equal(Capture1, 2) end)(length([1, 1])),
+ (fun(Capture1) -> expect:equal(Capture1, 0) end)(length([])),
+ (fun(Capture1) -> expect:equal(Capture1, 1) end)(length([1])),
+ (fun(Capture1) -> expect:equal(Capture1, 2) end)(length([1, 1])),
(fun(Capture1) -> expect:equal(Capture1, 3) end)(length([1, 1, 1])).
-endif.
@@ -20,7 +20,7 @@ reverse(A) ->
-ifdef(TEST).
reverse_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, 0) end)(length([])),
+ (fun(Capture1) -> expect:equal(Capture1, 0) end)(length([])),
(fun(Capture1) -> expect:equal(Capture1, 5) end)(length([1, 2, 3, 4, 5])).
-endif.
@@ -29,7 +29,7 @@ is_empty(List) ->
-ifdef(TEST).
is_empty_test() ->
- _ = expect:true(is_empty([])),
+ expect:true(is_empty([])),
expect:false(is_empty([1])).
-endif.
@@ -44,8 +44,8 @@ has_member(List, Elem) ->
-ifdef(TEST).
has_member_test() ->
- _ = expect:true(has_member([0, 4, 5, 1], 1)),
- _ = expect:false(has_member([0, 4, 5, 7], 1)),
+ expect:true(has_member([0, 4, 5, 1], 1)),
+ expect:false(has_member([0, 4, 5, 7], 1)),
expect:false(has_member([], 1)).
-endif.
@@ -60,9 +60,7 @@ head(List) ->
-ifdef(TEST).
head_test() ->
- _ = (fun(Capture1) ->
- expect:equal(Capture1, {ok, 0})
- end)(head([0, 4, 5, 7])),
+ (fun(Capture1) -> expect:equal(Capture1, {ok, 0}) end)(head([0, 4, 5, 7])),
(fun(Capture1) -> expect:equal(Capture1, {error, empty}) end)(head([])).
-endif.
@@ -77,10 +75,10 @@ tail(List) ->
-ifdef(TEST).
tail_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, [4, 5, 7]})
end)(tail([0, 4, 5, 7])),
- _ = (fun(Capture1) -> expect:equal(Capture1, {ok, []}) end)(tail([0])),
+ (fun(Capture1) -> expect:equal(Capture1, {ok, []}) end)(tail([0])),
(fun(Capture1) -> expect:equal(Capture1, {error, empty}) end)(tail([])).
-endif.
@@ -98,7 +96,7 @@ map(List, Fun) ->
-ifdef(TEST).
map_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, [])
end)((fun(Capture1) -> map(Capture1, fun(X) -> X * 2 end) end)([])),
(fun(Capture1) ->
@@ -135,7 +133,7 @@ traverse_test() ->
false ->
{error, X}
end end,
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, [10, 12, 10, 12]})
end)((fun(Capture1) -> traverse(Capture1, Fun) end)([5, 6, 5, 6])),
(fun(Capture1) ->
@@ -173,11 +171,9 @@ flatten(Lists) ->
-ifdef(TEST).
flatten_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, []) end)(flatten([])),
- _ = (fun(Capture1) -> expect:equal(Capture1, []) end)(flatten([[]])),
- _ = (fun(Capture1) ->
- expect:equal(Capture1, [])
- end)(flatten([[], [], []])),
+ (fun(Capture1) -> expect:equal(Capture1, []) end)(flatten([])),
+ (fun(Capture1) -> expect:equal(Capture1, []) end)(flatten([[]])),
+ (fun(Capture1) -> expect:equal(Capture1, []) end)(flatten([[], [], []])),
(fun(Capture1) ->
expect:equal(Capture1, [1, 2, 3, 4])
end)(flatten([[1, 2], [], [3, 4]])).
diff --git a/gen/map.erl b/gen/map.erl
index c2a07d4..7a4bafa 100644
--- a/gen/map.erl
+++ b/gen/map.erl
@@ -28,15 +28,13 @@ has_key(Map, Key) ->
-ifdef(TEST).
has_key_test() ->
- _ = expect:false((fun(Capture1) ->
- has_key(Capture1, 1)
- end)(from_list([]))),
- _ = expect:true((fun(Capture1) ->
- has_key(Capture1, 1)
- end)(from_list([{1, 0}]))),
- _ = expect:true((fun(Capture1) ->
- has_key(Capture1, 1)
- end)(from_list([{4, 0}, {1, 0}]))),
+ expect:false((fun(Capture1) -> has_key(Capture1, 1) end)(from_list([]))),
+ expect:true((fun(Capture1) ->
+ has_key(Capture1, 1)
+ end)(from_list([{1, 0}]))),
+ expect:true((fun(Capture1) ->
+ has_key(Capture1, 1)
+ end)(from_list([{4, 0}, {1, 0}]))),
expect:false((fun(Capture1) ->
has_key(Capture1, 0)
end)(from_list([{4, 0}, {1, 0}]))).
@@ -47,7 +45,7 @@ new() ->
-ifdef(TEST).
new_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, 0) end)(size(new())),
+ (fun(Capture1) -> expect:equal(Capture1, 0) end)(size(new())),
(fun(Capture1) -> expect:equal(Capture1, []) end)(to_list(new())).
-endif.
@@ -58,7 +56,7 @@ fetch(A, B) ->
fetch_test() ->
Proplist = [{4, 0}, {1, 1}],
Map = from_list(Proplist),
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, 0})
end)((fun(Capture1) -> fetch(Capture1, 4) end)(Map)),
(fun(Capture1) ->
diff --git a/gen/order.erl b/gen/order.erl
index 69f0eb8..e970ee7 100644
--- a/gen/order.erl
+++ b/gen/order.erl
@@ -18,8 +18,8 @@ reverse(Order) ->
-ifdef(TEST).
reverse_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(reverse(lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(reverse(eq)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(reverse(lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(reverse(eq)),
(fun(Capture1) -> expect:equal(Capture1, lt) end)(reverse(gt)).
-endif.
@@ -37,8 +37,8 @@ to_int(Order) ->
-ifdef(TEST).
to_int_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, -1) end)(to_int(lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, 0) end)(to_int(eq)),
+ (fun(Capture1) -> expect:equal(Capture1, -1) end)(to_int(lt)),
+ (fun(Capture1) -> expect:equal(Capture1, 0) end)(to_int(eq)),
(fun(Capture1) -> expect:equal(Capture1, 1) end)(to_int(gt)).
-endif.
@@ -65,14 +65,14 @@ compare(A, B) ->
-ifdef(TEST).
compare_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(lt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(eq, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(eq, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(eq, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(lt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(eq, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(eq, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(eq, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, eq)),
(fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(gt, gt)).
-endif.
@@ -90,14 +90,14 @@ max(A, B) ->
-ifdef(TEST).
max_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(max(lt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(lt, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(lt, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(eq, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(max(lt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(lt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(lt, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(eq, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, eq)),
(fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, gt)).
-endif.
@@ -115,13 +115,13 @@ min(A, B) ->
-ifdef(TEST).
min_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(eq, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, eq)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, gt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(gt, lt)),
- _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(eq, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, gt)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(gt, lt)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(gt, eq)),
(fun(Capture1) -> expect:equal(Capture1, gt) end)(min(gt, gt)).
-endif.
diff --git a/gen/result.erl b/gen/result.erl
index 101b56a..266b41f 100644
--- a/gen/result.erl
+++ b/gen/result.erl
@@ -15,7 +15,7 @@ is_ok(Result) ->
-ifdef(TEST).
is_ok_test() ->
- _ = expect:true(is_ok({ok, 1})),
+ expect:true(is_ok({ok, 1})),
expect:false(is_ok({error, 1})).
-endif.
@@ -30,7 +30,7 @@ is_error(Result) ->
-ifdef(TEST).
is_error_test() ->
- _ = expect:false(is_error({ok, 1})),
+ expect:false(is_error({ok, 1})),
expect:true(is_error({error, 1})).
-endif.
@@ -45,7 +45,7 @@ map(Result, Fun) ->
-ifdef(TEST).
map_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, 2})
end)((fun(Capture1) -> map(Capture1, fun(X) -> X + 1 end) end)({ok, 1})),
(fun(Capture1) ->
@@ -64,7 +64,7 @@ map_error(Result, Fun) ->
-ifdef(TEST).
map_error_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, 1})
end)((fun(Capture1) ->
map_error(Capture1, fun(X) -> X + 1 end)
@@ -87,13 +87,13 @@ flatten(Result) ->
-ifdef(TEST).
flatten_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, 1})
end)(flatten({ok, {ok, 1}})),
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {error, 1})
end)(flatten({ok, {error, 1}})),
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {error, 1})
end)(flatten({error, 1})),
(fun(Capture1) ->
@@ -118,12 +118,12 @@ flat_map(Result, Fun) ->
-ifdef(TEST).
flat_map_test() ->
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {error, 1})
end)((fun(Capture1) ->
flat_map(Capture1, fun(X) -> {ok, X + 1} end)
end)({error, 1})),
- _ = (fun(Capture1) ->
+ (fun(Capture1) ->
expect:equal(Capture1, {ok, 2})
end)((fun(Capture1) ->
flat_map(Capture1, fun(X) -> {ok, X + 1} end)
@@ -146,7 +146,7 @@ unwrap(Result, Default) ->
-ifdef(TEST).
unwrap_test() ->
- _ = (fun(Capture1) -> expect:equal(Capture1, 1) end)(unwrap({ok, 1}, 50)),
+ (fun(Capture1) -> expect:equal(Capture1, 1) end)(unwrap({ok, 1}, 50)),
(fun(Capture1) ->
expect:equal(Capture1, 50)
end)(unwrap({error, <<"nope">>}, 50)).