Skip to content

fix: resolve byte-compiler warnings#128

Open
dannywillems wants to merge 6 commits into
emacs-rustic:mainfrom
dannywillems:fix/byte-compile-warnings
Open

fix: resolve byte-compiler warnings#128
dannywillems wants to merge 6 commits into
emacs-rustic:mainfrom
dannywillems:fix/byte-compile-warnings

Conversation

@dannywillems
Copy link
Copy Markdown

Summary

This PR fixes byte-compiler warnings in the rustic source files. Each
warning type is addressed in its own commit, and only behaviour-preserving
changes were made. Warnings whose fix would change behaviour are left as-is.

The package minimum is Emacs 28.2, so the obsolescence fixes use
replacements available at or below that version (gensym, if-let*,
when-let*, all available since Emacs 26.1).

Fixed warnings (behaviour-preserving)

  • docstring wider than 80 characters: reflowed docstrings in
    rustic.el, rustic-babel.el, rustic-cargo.el, rustic-clippy.el,
    rustic-compile.el, rustic-lsp.el, rustic-flycheck.el.
  • docstring has wrong usage of unescaped single quotes: escaped the
    literal leading single quotes in rustic-cargo.el and
    rustic-interaction.el using \='.
  • cl-gensym is obsolete (31.1): replaced with gensym (available
    since 26.1) in rustic.el.
  • if-let / when-let are obsolete (31.1): replaced with if-let* /
    when-let* (available since 26.1) in rustic-babel.el,
    rustic-cargo.el, rustic-doc.el, rustic-rustfmt.el.
  • unused lexical argument: underscore-prefixed unused function and
    lambda parameters in rustic-cargo.el and rustic-clippy.el.

CI

Adds a byte-compile.yml workflow that byte-compiles and loads every
source file on Emacs 28.2 (the package minimum), 30.1, and snapshot, with
dependencies installed from MELPA. It does not use -Werror because the
residual warnings below come from optional, external integrations.

Residual warnings (left intentionally)

These would require behaviour changes or depend on optional/external
packages, so they are not addressed here:

  • replace-buffer-contents -> replace-region-contents (behaviour change;
    rustic-rustfmt.el).
  • project-roots -> project-root (behaviour change; rustic-rustfmt.el).
  • defcustom for rustic-popup-commands: list without arguments
    (:type widget change; rustic-popup.el).
  • value from call to f-exists? is unused (rustic-doc.el): removing it
    would change behaviour.
  • assignment/reference to free variables tied to optional integrations
    (rust-* save hooks, result, command, eglot,
    flymake--diagnostics-buffer-source, flycheck-error-list-buffer,
    poly-*, rustic-compilation-workspace).
  • functions not known to be defined, from optional integrations
    (inheritenv-apply, define-polymode/define-innermode/define-hostmode,
    lsp-*, eglot-*, flycheck-*, flymake-*, jsonrpc-request,
    -semver-*, rustic-cargo-bin forward reference).
  • global/dynamic var 'eglot' lacks a prefix (external dynamic var).

Reflow docstrings that exceeded 80 columns so the byte-compiler no
longer emits "docstring wider than 80 characters" warnings.  Wording
is preserved; only line breaks and minor phrasing changes were made.
Use `\='` to escape the literal leading single quotes that the
byte-compiler flagged as "wrong usage of unescaped single quotes".
The rendered docstrings are unchanged.
`cl-gensym` is obsolete as of Emacs 31.1.  `gensym` has been
available since Emacs 26.1, below the package minimum of 28.2, so the
replacement does not raise the minimum required version.
`if-let` and `when-let` are obsolete as of Emacs 31.1.  The starred
variants `if-let*`/`when-let*` have been available since Emacs 26.1,
below the package minimum of 28.2, and behave identically for these
binding forms.
Rename unused function and lambda parameters to use a leading
underscore so the byte-compiler no longer warns about unused lexical
arguments.  Behaviour is unchanged.
Add a GitHub Actions workflow that byte-compiles and loads every source
file on Emacs 28.2 (the package minimum), 30.1, and snapshot.  Package
dependencies are installed from MELPA.  The workflow does not use
-Werror because several residual warnings come from optional, external
integrations (flycheck, polymode, lsp-mode, eglot).
@dannywillems
Copy link
Copy Markdown
Author

This is an automated effort to help maintaining packages in the Emacs community. See https://x.com/dwillems42/status/2060720730338185699 and https://dannywillems.github.io/emacs-package-maintenance/

@jcs090218
Copy link
Copy Markdown
Member

We already compiling the source with eask compile; see https://github.com/emacs-rustic/rustic/actions/runs/24094434046/job/70289119000#step:8:108. 🤔

@dannywillems
Copy link
Copy Markdown
Author

It seems that warnings are ignored: https://github.com/emacs-rustic/rustic/actions/runs/24094434046/job/70289119000#step:8:107.
Would you be interested in turning them into errors, and fixes the existing ones?

@dannywillems dannywillems force-pushed the fix/byte-compile-warnings branch 2 times, most recently from 7a1991c to fbf3d5b Compare May 31, 2026 11:52
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