Remove unused require Logger#326
Open
wimwian wants to merge 2 commits into
Open
Conversation
EventStore.Storage.Lock and EventStore.Storage.Database never call any Logger.* function, so `require Logger` triggers an "unused require Logger" warning on Elixir 1.20. Removing it since it has no effect on behavior.
Elixir 1.20's type checker can't prove `recorded_event` (destructured
from the {recorded_event, index} tuple produced by Enum.with_index/2)
is a %RecordedEvent{} at the point it's used in a struct update:
warning: a struct for EventStore.RecordedEvent is expected on
struct update
map_to_recorded_event/3 always returns %RecordedEvent{}, so this is a
type-checker visibility gap, not a real bug — pattern-matching
%RecordedEvent{} in the anonymous function head makes the invariant
explicit and resolves the warning.
yordis
approved these changes
Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
require Loggerline from two modules that never callLogger.*:EventStore.Storage.Lock(lib/event_store/storage/lock.ex)EventStore.Storage.Database(lib/event_store/storage/database.ex)On Elixir 1.20 these trigger "unused require Logger" compiler warnings. This change has no runtime effect — it just clears the warnings.
I read through both files in full to confirm there is no
Loggerusage anywhere before removing the requires.Test plan
mix deps.get && mix compile --force— both warnings gone, no new warnings introduced in eventstore's own codemix event_store.setupagainst a local Postgres, thenmix test— 389/391 tests + 2/2 doctests passed. The 2 failures (NotificationsSupervisorTestandSubscribeToStreamTest, both assertingProcess.info(pid, :current_function) == {:erlang, :hibernate, 3}) are pre-existing on unmodifiedmasterin this environment (verified viagit stash) — an OTP-version-dependent hibernate implementation detail, unrelated to this change.mix format— no changes needed beyond the diff (reverted one unrelated pre-existing formatting diff insnapshot.expicked up by a full-projectmix formatrun, to keep this PR scoped to the tworequire Loggerremovals)