Skip to content

fix: silence compiler warnings on Elixir 1.20.1#892

Merged
yordis merged 1 commit into
elixir-tesla:masterfrom
gilbertwong96:fix-warnings-1-20
Jun 25, 2026
Merged

fix: silence compiler warnings on Elixir 1.20.1#892
yordis merged 1 commit into
elixir-tesla:masterfrom
gilbertwong96:fix-warnings-1-20

Conversation

@gilbertwong96

Copy link
Copy Markdown
Contributor
  • preferred_cli_env (Mix 1.20 deprecation): move from def project into def cli [preferred_envs: ...].
  • Drop unused require Tesla.Adapter.Httpc in lib/tesla.ex (the module defines no macros, so the require was unnecessary; @default_adapter just references the module atom).
  • Relocate next_reply_state/2 and terminal_reply_message?/1 in lib/tesla/adapter/gun.ex into the gun 1.x else branch next to their sole caller reply_router/6 (dead code under gun 2.x — the closure-based wrap_reply_to is used instead, so reply_router and these helpers were unused code compiled at module top-level).

mix.lock is unchanged — HEAD already locks the same dep versions, and no dep is added or removed. Full test suite passes (1034 tests).

- preferred_cli_env (Mix 1.20 deprecation): move from def project into def cli [preferred_envs: ...].

- Drop unused require Tesla.Adapter.Httpc in lib/tesla.ex (the module defines no macros, so the require was unnecessary; @default_adapter just references the module atom).

- Relocate next_reply_state/2 and terminal_reply_message?/1 in lib/tesla/adapter/gun.ex into the gun 1.x else branch next to their sole caller reply_router/6. Under gun 2.x the closure-based wrap_reply_to is used, so reply_router (and these helpers) were dead code compiled at module top-level.

mix.lock is unchanged. Full test suite passes (1034 tests).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Tesla’s Elixir project configuration and adapter code to eliminate compiler warnings on Elixir 1.20.1 (Mix 1.20), primarily by adopting the new CLI env configuration API, removing an unnecessary require, and scoping gun 1.x-only helper functions to avoid unused-function warnings under gun 2.x.

Changes:

  • Move preferred_cli_env configuration from project/0 into cli/0 via preferred_envs (Mix 1.20 deprecation fix).
  • Remove unused require Tesla.Adapter.Httpc from lib/tesla.ex.
  • Relocate gun 1.x-only reply-routing helpers (next_reply_state/2, terminal_reply_message?/1) into the gun 1.x branch near their only call site.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
mix.exs Switches CLI preferred env configuration to cli/0 (preferred_envs) to silence Mix 1.20 deprecation warnings.
lib/tesla.ex Removes an unnecessary require for the default adapter module.
lib/tesla/adapter/gun.ex Scopes gun 1.x-only private helpers into the gun 1.x branch to avoid unused-function warnings under gun 2.x.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yordis yordis merged commit 863d836 into elixir-tesla:master Jun 25, 2026
10 of 12 checks passed
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.

3 participants