Skip to content

Error in flycheck-rust-setup: (json-end-of-file) #86

@LeGuipo

Description

@LeGuipo

Because cargo clippy is not included in my distribution’s outdated packages, I decided to install the rust suite via rustup.
Everything about using rust work fine, including clippy, but now flycheck can’t initialize anymore the rust checkers, throwing the message Error in flycheck-rust-setup: (json-end-of-file) after opening a rust project source file.

  • Here is the output of the flycheck-verify-setup :
Syntax checkers for buffer main.rs in rust-mode:

No checker to run in this buffer.

Checkers that are compatible with this mode, but will not run until properly configured:

  rust-cargo (manually disabled) enable
    - may enable:  yes
    - may run:     t
    - executable:  Found at /opt/cargo/bin/cargo
    - Cargo.toml:  Found
    - Crate type:  lib
    - Binary name: Not required

  rust (manually disabled) enable
    - may enable: yes
    - may run:    t
    - executable: Found at /opt/cargo/bin/rustc

  rust-clippy (automatically disabled) reset
    - may enable: no
    - may run:    t
    - executable: Found at /opt/cargo/bin/cargo
    - Clippy:     Cannot find the `cargo clippy' command
    - Cargo.toml: Found

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 33snapshot (package: 20230306.414)
Emacs version:    27.1
System:           aarch64-unknown-linux-gnu
Window system:    x
  • $PATH = /home/user1/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/opt/cargo/bin
  • $RUSTUP_HOME = /opt/rustup
  • $CARGO_HOME = /opt/cargo
  • My init.el part setting up flycheck :
;; FLYCHECK
(add-hook 'after-init-hook #'global-flycheck-mode)
(with-eval-after-load 'rust-mode
  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
  (setq-default flycheck-disabled-checkers '(rust-cargo rust))
  (setq-default flycheck-rust-checker 'rust-clippy))

I have no clue how to fix this… It’s like the distribution packages include some additional tweaks to make it work, not rustup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions