Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Robbepop opened this issue Mar 19, 2025 · 0 comments
Open

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

Robbepop opened this issue Mar 19, 2025 · 0 comments

Comments

@Robbepop
Copy link

Robbepop commented Mar 19, 2025

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

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

No branches or pull requests

2 participants