Skip to content

Commit cdf1bcc

Browse files
committed
Simplify optional callback computation
1 parent 7e83e8c commit cdf1bcc

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/ex_doc/language/source.ex

+6-13
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,14 @@ defmodule ExDoc.Language.Source do
207207
|> Map.new()
208208
end
209209

210-
def get_optional_callbacks(module, type) do
211-
optional_callbacks =
212-
type == :behaviour &&
213-
try do
214-
module.behaviour_info(:optional_callbacks)
215-
rescue
216-
FunctionClauseError -> :undefined
217-
end
218-
219-
case optional_callbacks do
220-
:undefined -> []
221-
_ -> optional_callbacks
222-
end
210+
def get_optional_callbacks(module, :behaviour) do
211+
module.behaviour_info(:optional_callbacks)
212+
rescue
213+
FunctionClauseError -> []
223214
end
224215

216+
def get_optional_callbacks(_module, _type), do: []
217+
225218
def find_ast(ast, source_basedir, fun) do
226219
filtermap_ast(ast, source_basedir, fun) |> hd()
227220
end

0 commit comments

Comments
 (0)