Skip to content

Commit f6b4995

Browse files
committed
Fix warnings
Signed-off-by: Jakub Gonet <jakub.gonet@swmansion.com>
1 parent aa2a6f4 commit f6b4995

File tree

5 files changed

+45
-46
lines changed

5 files changed

+45
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Added support for `ets:update_counter/3` and `ets:update_counter/4`.
2323
- Added `erlang:+/1`
2424
- Added `lists:append/1` and `lists:append/2`
25-
- Support for zero count in `lists:duplicate/2`.
2625
- Added `lists:dropwhile/2`.
2726

2827
### Fixed
2928
- ESP32: improved sntp sync speed from a cold boot.
3029
- Utilize reserved `phy_init` partition on ESP32 to store wifi calibration for faster connections.
30+
- Support for zero count in `lists:duplicate/2`.
3131

3232
## [0.6.6] - Unreleased
3333

libs/eavmlib/src/esp.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ nvs_reformat() ->
486486
%% @end
487487
%%-----------------------------------------------------------------------------
488488
-spec partition_erase_range(Partition_id :: binary(), Offset :: non_neg_integer()) -> ok | error.
489-
partition_erase_range(Partition_id, Offset) ->
489+
partition_erase_range(_Partition_id, _Offset) ->
490490
erlang:nif_error(undefined).
491491

492492
%%-----------------------------------------------------------------------------
@@ -505,7 +505,7 @@ partition_erase_range(Partition_id, Offset) ->
505505
-spec partition_erase_range(
506506
Partition_id :: binary(), Offset :: non_neg_integer(), Size :: pos_integer()
507507
) -> ok | error.
508-
partition_erase_range(Partition_id, Offset, Size) ->
508+
partition_erase_range(_Partition_id, _Offset, _Size) ->
509509
erlang:nif_error(undefined).
510510

511511
%%-----------------------------------------------------------------------------
@@ -531,7 +531,7 @@ partition_list() ->
531531
-spec partition_read(
532532
Partition_id :: binary(), Offset :: non_neg_integer(), Read_size :: non_neg_integer()
533533
) -> {ok, binary()} | error.
534-
partition_read(Partition_id, Offset, Read_size) ->
534+
partition_read(_Partition_id, _Offset, _Read_size) ->
535535
erlang:nif_error(undefined).
536536

537537
%%-----------------------------------------------------------------------------
@@ -550,7 +550,7 @@ partition_read(Partition_id, Offset, Read_size) ->
550550
%%-----------------------------------------------------------------------------
551551
-spec partition_write(Partition_id :: binary(), Offset :: non_neg_integer(), Data :: binary()) ->
552552
ok | error.
553-
partition_write(Partition_id, Offset, Data) ->
553+
partition_write(_Partition_id, _Offset, _Data) ->
554554
erlang:nif_error(undefined).
555555

556556
%%-----------------------------------------------------------------------------

libs/estdlib/src/lists.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ unique([X, Y | Tail], Fun) ->
731731
false ->
732732
[X | unique([Y | Tail], Fun)]
733733
end.
734-
734+
735735
%%-----------------------------------------------------------------------------
736736
%% @param Pred the predicate to check against elements in List1
737737
%% @param List1

tests/erlang_tests/unary_plus.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ start() ->
2929
0.
3030

3131
unary_plus_int(A) ->
32-
+A,
32+
A = +A,
3333
ok.
3434

3535
unary_plus_float(A) ->
36-
+A,
36+
A = +A,
3737
ok.
3838

3939
unary_plus_str(A) ->

tests/libs/estdlib/test_lists.erl

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -101,54 +101,45 @@ test_keydelete() ->
101101
?ASSERT_MATCH(lists:keydelete(a, 1, []), []),
102102
?ASSERT_MATCH(lists:keydelete(a, 1, [{a, x}, b, []]), [b, []]),
103103
?ASSERT_MATCH(lists:keydelete(a, 1, [b, {a, x}, []]), [b, []]),
104-
?ASSERT_MATCH(lists:keydelete(a, 1, [b, {a, x}, {a, x}, {a, x}, []]), [b, {a, x}, {a, x}, []]),
104+
?ASSERT_MATCH(
105+
lists:keydelete(a, 1, [b, {a, x}, {a, x}, {a, x}, []]),
106+
[b, {a, x}, {a, x}, []]
107+
),
105108
ok.
106109

107110
test_keyreplace() ->
108111
?ASSERT_MATCH(lists:keyreplace(a, 1, [], {foo, bar}), []),
109112
?ASSERT_MATCH(lists:keyreplace(a, 1, [{a, x}, b, []], {1, 2}), [{1, 2}, b, []]),
110113
?ASSERT_MATCH(lists:keyreplace(x, 2, [b, {a, x}, []], {1, 2}), [b, {1, 2}, []]),
111-
?ASSERT_MATCH(lists:keyreplace(a, 1, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}), [
112-
b,
113-
{1, 2},
114-
{a, x},
115-
{a, x},
116-
[]
117-
]),
118-
?ASSERT_MATCH(lists:keyreplace(a, 3, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}), [
119-
b,
120-
{a, x},
121-
{a, x},
122-
{a, x},
123-
[]
124-
]),
114+
?ASSERT_MATCH(
115+
lists:keyreplace(a, 1, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}),
116+
[b, {1, 2}, {a, x}, {a, x}, []]
117+
),
118+
?ASSERT_MATCH(
119+
lists:keyreplace(a, 3, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}),
120+
[b, {a, x}, {a, x}, {a, x}, []]
121+
),
125122
ok.
126123

127124
test_keystore() ->
128125
?ASSERT_MATCH(lists:keystore(a, 1, [], {foo, bar}), [{foo, bar}]),
129126
?ASSERT_MATCH(lists:keystore(a, 1, [{a, x}, b, []], {1, 2}), [{1, 2}, b, []]),
130127
?ASSERT_MATCH(lists:keystore(x, 2, [b, {a, x}, []], {1, 2}), [b, {1, 2}, []]),
131-
?ASSERT_MATCH(lists:keystore(a, 1, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}), [
132-
b,
133-
{1, 2},
134-
{a, x},
135-
{a, x},
136-
[]
137-
]),
138-
?ASSERT_MATCH(lists:keystore(a, 3, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}), [
139-
b,
140-
{a, x},
141-
{a, x},
142-
{a, x},
143-
[],
144-
{1, 2}
145-
]),
128+
?ASSERT_MATCH(
129+
lists:keystore(a, 1, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}),
130+
[b, {1, 2}, {a, x}, {a, x}, []]
131+
),
132+
?ASSERT_MATCH(
133+
lists:keystore(a, 3, [b, {a, x}, {a, x}, {a, x}, []], {1, 2}),
134+
[b, {a, x}, {a, x}, {a, x}, [], {1, 2}]
135+
),
146136
ok.
147137

148138
test_keytake() ->
149139
List1 = [{name, "Joe"}, {name, "Robert"}, {name, "Mike"}],
150140
?ASSERT_MATCH(
151-
lists:keytake("Joe", 2, List1), {value, {name, "Joe"}, [{name, "Robert"}, {name, "Mike"}]}
141+
lists:keytake("Joe", 2, List1),
142+
{value, {name, "Joe"}, [{name, "Robert"}, {name, "Mike"}]}
152143
),
153144
?ASSERT_MATCH(
154145
lists:keytake("Robert", 2, List1),
@@ -210,7 +201,10 @@ test_flatten() ->
210201
?ASSERT_MATCH(lists:flatten([[a], [b]]), [a, b]),
211202
?ASSERT_MATCH(lists:flatten([[a], [b, [c]]]), [a, b, c]),
212203
?ASSERT_MATCH(lists:flatten([[a], [b, {c, [d, [e, [f]]]}]]), [a, b, {c, [d, [e, [f]]]}]),
213-
?ASSERT_MATCH(lists:flatten([[a, b, c], [d, e, f], [g, h, i]]), [a, b, c, d, e, f, g, h, i]),
204+
?ASSERT_MATCH(
205+
lists:flatten([[a, b, c], [d, e, f], [g, h, i]]),
206+
[a, b, c, d, e, f, g, h, i]
207+
),
214208
ok.
215209

216210
test_filter() ->
@@ -245,7 +239,6 @@ test_seq() ->
245239
?ASSERT_ERROR(lists:seq(-1, 1, -1)),
246240
?ASSERT_ERROR(lists:seq(1, -1, 1)),
247241
?ASSERT_ERROR(lists:seq(1, 2, 0)),
248-
249242
ok.
250243

251244
test_sort() ->
@@ -288,15 +281,17 @@ test_usort() ->
288281
?ASSERT_MATCH(lists:usort([1, 3, 5, 2, 1, 4]), [1, 2, 3, 4, 5]),
289282
?ASSERT_MATCH(lists:usort([1, 3, 5, 2, 5, 4]), [1, 2, 3, 4, 5]),
290283

291-
?ASSERT_MATCH(lists:usort(fun(A, B) -> A > B end, [1, 2, 3, 4, 3, 5]), [5, 4, 3, 3, 2, 1]),
284+
?ASSERT_MATCH(
285+
lists:usort(fun(A, B) -> A > B end, [1, 2, 3, 4, 3, 5]),
286+
[5, 4, 3, 3, 2, 1]
287+
),
292288
?ASSERT_MATCH(lists:usort(fun(A, B) -> A >= B end, [1, 2, 3, 4, 3, 5]), [5, 4, 3, 2, 1]),
293289

294290
?ASSERT_ERROR(lists:usort(1), function_clause),
295291
?ASSERT_ERROR(lists:usort(fun(A, B) -> A > B end, 1), function_clause),
296292
?ASSERT_ERROR(lists:usort(1, [1]), function_clause),
297-
298293
ok.
299-
294+
300295
test_dropwhile() ->
301296
?ASSERT_MATCH(lists:dropwhile(fun(_X) -> true end, []), []),
302297
?ASSERT_MATCH(lists:dropwhile(fun(_X) -> false end, []), []),
@@ -338,7 +333,10 @@ test_last() ->
338333

339334
test_mapfoldl() ->
340335
?ASSERT_MATCH({[], 1}, lists:mapfoldl(fun(X, A) -> {X * A, A + 1} end, 1, [])),
341-
?ASSERT_MATCH({[1, 4, 9], 4}, lists:mapfoldl(fun(X, A) -> {X * A, A + 1} end, 1, [1, 2, 3])),
336+
?ASSERT_MATCH(
337+
{[1, 4, 9], 4},
338+
lists:mapfoldl(fun(X, A) -> {X * A, A + 1} end, 1, [1, 2, 3])
339+
),
342340
?ASSERT_ERROR(lists:mapfoldl(fun(X, A) -> {X * A, A + 1} end, 1, foo), function_clause),
343341
ok.
344342

@@ -354,4 +352,5 @@ test_append() ->
354352
?ASSERT_ERROR(lists:append(1, 3), badarg),
355353
ok.
356354

357-
id(X) -> X.
355+
id(X) ->
356+
X.

0 commit comments

Comments
 (0)