Skip to content

Weird new-line that does not shrink line width #6515

Open
@Robbepop

Description

@Robbepop

Version: rustfmt 1.8.0-nightly (75530e9f72 2025-03-18)

In my Wasmi project I have got the following Rust line of code:

    /// Executes an [`Instruction::CallImported`].
    pub fn execute_call_imported<T>(
        &mut self,
        store: &mut Store<T>,
        results: RegSpan,
        func: index::Func,
    ) -> Result<(), Error> {
        let func = self.get_func(func);
        _ = self.execute_call_imported_impl::<marker::NestedCall, T>(store, Some(results), &func)?;
        Ok(())
    }

And rustfmt decided to re-format this the assignment line to this:

        _ =
            self.execute_call_imported_impl::<marker::NestedCall, T>(store, Some(results), &func)?;

Note that rustfmt probably did this to reduce the line-width, however, given that _ = is so short and we are using 4 whitespaces for indentation, this change did not actually reduce the line's width and just introduced an unnecessary new-line which also made to code less readable in my opinion.

PR where I first saw this: wasmi-labs/wasmi#1398

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Robbepop@ytmimi

        Issue actions

          Weird new-line that does not shrink line width · Issue #6515 · rust-lang/rustfmt