Skip to content

Commit

Permalink
Enable -Wunmatched_return in dialyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristgit committed Apr 19, 2024
1 parent a82e9f4 commit ba6ea03
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions lib/mix/tasks/gh/docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule Mix.Tasks.Gh.Docs do

# Taken from https://gist.github.com/jjh42/5737777 with some modifications
@shortdoc "Mix task to publish gh-pages site."
@dialyzer {:nowarn_function, run: 1}
def run(_) do
File.rm_rf("doc")
Mix.Task.run("docs")
Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ defmodule Nostrum.Api do
"""
@spec update_status(status, String.t(), integer, String.t() | nil) :: :ok
def update_status(status, game, type \\ 0, stream \\ nil) do
Supervisor.update_status(to_string(status), game, stream, type)
_result = Supervisor.update_status(to_string(status), game, stream, type)
:ok
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/channel_cache/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Nostrum.Cache.ChannelCache.ETS do
@doc "Set up the cache's ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/channel_guild_mapping/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule Nostrum.Cache.ChannelGuildMapping.ETS do
@doc "Set up the ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/guild_cache/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Nostrum.Cache.GuildCache.ETS do
@doc "Set up the cache's ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(tabname(), [:set, :public, :named_table])
_tid = :ets.new(tabname(), [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/member_cache/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule Nostrum.Cache.MemberCache.ETS do
@doc "Set up the cache's ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/presence_cache/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Nostrum.Cache.PresenceCache.ETS do
@doc "Set up the cache's ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/cache/user_cache/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Nostrum.Cache.UserCache.ETS do
@doc "Set up the ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
7 changes: 4 additions & 3 deletions lib/nostrum/consumer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,10 @@ defmodule Nostrum.Consumer do

@impl GenServer
def handle_info({:event, event}, state) do
Task.start_link(fn ->
__MODULE__.handle_event(event)
end)
{:ok, _pid} =
Task.start_link(fn ->
__MODULE__.handle_event(event)
end)

{:noreply, state}
end
Expand Down
6 changes: 3 additions & 3 deletions lib/nostrum/shard/dispatch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ defmodule Nostrum.Shard.Dispatch do

def handle_event(:GUILD_MEMBER_ADD = event, p, state) do
GuildCache.member_count_up(p.guild_id)
UserCache.create(p.user)
_new_user = UserCache.create(p.user)
{event, {p.guild_id, MemberCache.create(p.guild_id, p)}, state}
end

Expand Down Expand Up @@ -345,7 +345,7 @@ defmodule Nostrum.Shard.Dispatch do
voice = Voice.get_voice(p.guild_id)

if voice.persist_playback,
do: Voice.resume(p.guild_id)
do: _result = Voice.resume(p.guild_id)

{event, VoiceReady.to_struct(p), state}
end
Expand Down Expand Up @@ -386,7 +386,7 @@ defmodule Nostrum.Shard.Dispatch do
end
end

GuildCache.voice_state_update(p.guild_id, p)
{_updated, _states} = GuildCache.voice_state_update(p.guild_id, p)
{event, VoiceState.to_struct(p), state}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/store/guild_shard_mapping/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Nostrum.Store.GuildShardMapping.ETS do
@doc "Set up the store's ETS table."
@impl Supervisor
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nostrum/store/unavailable_guild/ets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Nostrum.Store.UnavailableGuild.ETS do
@impl Supervisor
@doc "Set up the store's ETS table."
def init(_init_arg) do
:ets.new(@table_name, [:set, :public, :named_table])
_tid = :ets.new(@table_name, [:set, :public, :named_table])
Supervisor.init([], strategy: :one_for_one)
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ defmodule Nostrum.Mixfile do
plt_add_deps: :transitive,
plt_add_apps: [:mix, :mnesia],
# "-Wmissing_return"]
flags: ["-Wextra_return", "-Werror_handling"]
flags: ["-Wextra_return", "-Werror_handling", "-Wunmatched_returns"]
]
end
end

0 comments on commit ba6ea03

Please sign in to comment.