Skip to content

Commit e987940

Browse files
committed
add state type for no_spec_with_records warning
1 parent 7002bf4 commit e987940

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/async_iterate.erl

+9-7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
next_position :: non_neg_integer(),
4141
finished :: boolean()}).
4242

43+
-type state() :: #state{}.
44+
4345
%% Sleep interval when waiting for more data.
4446
-define(INTERVAL, 300).
4547

@@ -65,7 +67,7 @@ next(Continuation) ->
6567
%%%===================================================================
6668

6769
%% @private
68-
-spec init([term()]) -> {ok, #state{}}.
70+
-spec init([term()]) -> {ok, state()}.
6971
init([Unique, Function]) ->
7072
%% Generate an ets table to store results.
7173
Tid = ets:new(Unique, []),
@@ -85,8 +87,8 @@ init([Unique, Function]) ->
8587
finished=false}}.
8688

8789
%% @private
88-
-spec handle_call(term(), {pid(), term()}, #state{}) ->
89-
{reply, term(), #state{}}.
90+
-spec handle_call(term(), {pid(), term()}, state()) ->
91+
{reply, term(), state()}.
9092
handle_call(iterator, _From, #state{tid=Tid}=State) ->
9193
{[Match], Continuation} = ets:select(Tid, [{{'$1', '$2'}, [], ['$2']}], 1),
9294
{reply, {ok, {Match, Continuation}}, State};
@@ -97,12 +99,12 @@ handle_call(_Msg, _From, State) ->
9799
{reply, ok, State}.
98100

99101
%% @private
100-
-spec handle_cast(term(), #state{}) -> {noreply, #state{}}.
102+
-spec handle_cast(term(), state()) -> {noreply, state()}.
101103
handle_cast(_Msg, State) ->
102104
{noreply, State}.
103105

104106
%% @private
105-
-spec handle_info(term(), #state{}) -> {noreply, #state{}}.
107+
-spec handle_info(term(), state()) -> {noreply, state()}.
106108
handle_info({retry, From, Continuation}, #state{finished=Finished}=State) ->
107109
read(From, Finished, Continuation),
108110
{noreply, State};
@@ -122,12 +124,12 @@ handle_info(_Msg, State) ->
122124
{noreply, State}.
123125

124126
%% @private
125-
-spec terminate(term(), #state{}) -> term().
127+
-spec terminate(term(), state()) -> term().
126128
terminate(_Reason, _State) ->
127129
ok.
128130

129131
%% @private
130-
-spec code_change(term() | {down, term()}, #state{}, term()) -> {ok, #state{}}.
132+
-spec code_change(term() | {down, term()}, state(), term()) -> {ok, state()}.
131133
code_change(_OldVsn, State, _Extra) ->
132134
{ok, State}.
133135

0 commit comments

Comments
 (0)