#16285·helix

`cargo fmt` cannot be used for Rust projects in Helix

Author: EpicVon2468Created Sep 16, 2026Updated Sep 16, 2026
LabelsC-bug

Summary

To my understanding, currently Helix pipes the actively viewed file into the configured formatter command's stdin, as it is intended for the rustfmt command. I've tried to switch the command to cargo with args of fmt & --, however Helix still pipes through stdin, meaning the command fails because cargo fmt already passes file names into rustfmt, and the additional stdin stream confuses rustfmt.

For additional context, I am in a workspace project. The reason I am using cargo fmt instead of rustfmt is because using rustfmt is ignoring my workspace's .rustfmt.toml.

Reproduction Steps

I tried this:

  1. Have a configured .rustfmt.toml in my workspace's root;
  2. Configure .helix/languages.toml to use cargo fmt -- / cargo fmt;
  3. Run Helix;
  4. Trust the workspace; and
  5. Edit a Rust file and save; or
  6. Run :fmt whilst in a Rust file.

I expected this to happen:

Helix would format my code according to my .rustfmt.toml with no issues.

Instead, this happened:

Formatter can't run because cargo fmt expects no stdin.

Helix log

~/.cache/helix/helix.log
2026-09-16T23:33:09.577 helix_view::document [ERROR] Formatter error: Failed to find targets
This utility formats all bin and lib files of the current crate using rustfmt.

Usage: cargo fmt [OPTIONS] [-- <rustfmt_options>...]

Arguments:
  [rustfmt_options]...  Options passed to rustfmt

Options:
  -q, --quiet
          No output printed to stdout
  -v, --verbose
          Use verbose output
      --version
          Print rustfmt version and exit
  -p, --package <package>...
          Specify package to format
      --manifest-path <manifest-path>
          Specify path to Cargo.toml
      --message-format <message-format>
          Specify message-format: short|json|human
      --all
          Format all packages, and also their local path-based dependencies
      --check
          Run rustfmt in check mode
  -h, --help
          Print help

Platform

Linux

Terminal Emulator

alacritty 0.18.0-dev (852e971)

Installation Method

source

Helix Version

helix 25.07.1 (079a789e)