fix: silence compiler warnings on Elixir 1.20.1#892
Merged
Conversation
- 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).
There was a problem hiding this comment.
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_envconfiguration fromproject/0intocli/0viapreferred_envs(Mix 1.20 deprecation fix). - Remove unused
require Tesla.Adapter.Httpcfromlib/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.
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.
def projectintodef cli [preferred_envs: ...].require Tesla.Adapter.Httpcinlib/tesla.ex(the module defines no macros, so the require was unnecessary;@default_adapterjust references the module atom).next_reply_state/2andterminal_reply_message?/1inlib/tesla/adapter/gun.exinto the gun 1.xelsebranch next to their sole callerreply_router/6(dead code under gun 2.x — the closure-basedwrap_reply_tois used instead, soreply_routerand these helpers were unused code compiled at module top-level).mix.lockis unchanged — HEAD already locks the same dep versions, and no dep is added or removed. Full test suite passes (1034 tests).