Skip to content

Remove unused require Logger#326

Open
wimwian wants to merge 2 commits into
commanded:masterfrom
wimwian:fix/unused-require-logger
Open

Remove unused require Logger#326
wimwian wants to merge 2 commits into
commanded:masterfrom
wimwian:fix/unused-require-logger

Conversation

@wimwian

@wimwian wimwian commented Jul 26, 2026

Copy link
Copy Markdown

Summary

Removes the require Logger line from two modules that never call Logger.*:

  • 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 Logger usage anywhere before removing the requires.

Test plan

  • mix deps.get && mix compile --force — both warnings gone, no new warnings introduced in eventstore's own code
  • mix event_store.setup against a local Postgres, then mix test — 389/391 tests + 2/2 doctests passed. The 2 failures (NotificationsSupervisorTest and SubscribeToStreamTest, both asserting Process.info(pid, :current_function) == {:erlang, :hibernate, 3}) are pre-existing on unmodified master in this environment (verified via git 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 in snapshot.ex picked up by a full-project mix format run, to keep this PR scoped to the two require Logger removals)

wimwian added 2 commits July 26, 2026 10:55
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants