Skip to content

Commit

Permalink
Use pattern matching on underscored functions, closes #1784
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Sep 28, 2023
1 parent 16a8f53 commit 51d8387
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ex_doc/language/elixir.ex
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ defmodule ExDoc.Language.Elixir do
# If it is none, then we need to look at underscore.
# TODO: We can remove this on Elixir v1.13 as all underscored are hidden.
defp doc?({{_, name, _}, _, _, :none, _}, _type) do
hd(Atom.to_charlist(name)) != ?_
not match?([?_ | _], Atom.to_charlist(name))
end

# Everything else is hidden.
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_doc/refs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ defmodule ExDoc.Refs do

defguardp has_no_docs(doc) when doc == :none or doc == %{}

defp starts_with_underscore?(name), do: hd(Atom.to_charlist(name)) == ?_
defp starts_with_underscore?(name), do: match?([?_ | _], Atom.to_charlist(name))

defp visibility(:hidden),
do: :hidden
Expand Down

0 comments on commit 51d8387

Please sign in to comment.