Skip to content

Commit e2b48ef

Browse files
author
José Valim
committed
Clean up nested conditionals
1 parent 15a6772 commit e2b48ef

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lib/iex/lib/iex/introspection.ex

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,23 @@ defmodule IEx.Introspection do
116116
end
117117

118118
defp h_mod_fun_arity(mod, fun, arity) when is_atom(mod) do
119-
if docs = Code.get_docs(mod, :docs) do
120-
if doc = find_doc(docs, fun, arity) do
119+
docs = Code.get_docs(mod, :docs)
120+
121+
cond do
122+
is_nil(docs) ->
123+
:no_docs
124+
doc = find_doc(docs, fun, arity) ->
121125
if callback_module = is_nil(elem(doc, 4)) and callback_module(mod, fun, arity) do
122126
filter = &match?({^fun, ^arity}, elem(&1, 0))
123127
print_callback_docs(callback_module, filter, &print_doc/2)
124128
else
125129
print_doc(doc)
126130
end
127131
:ok
128-
else
129-
if has_callback?(mod, fun, arity) do
130-
:behaviour_found
131-
else
132-
:not_found
133-
end
134-
end
135-
else
136-
:no_docs
132+
has_callback?(mod, fun, arity) ->
133+
:behaviour_found
134+
true ->
135+
:not_found
137136
end
138137
end
139138

0 commit comments

Comments
 (0)