Skip to content

Long strings prevent formatting method syntax on edition 2024 #6480

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

Closed
moriyoshi-kasuga opened this issue Feb 21, 2025 · 1 comment
Closed

Comments

@moriyoshi-kasuga
Copy link

moriyoshi-kasuga commented Feb 21, 2025

fn main() {
    fn hey(s: &str) -> &str {
        s
    }

    let _ ="
hheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyh
hheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyh
".trim()           .trim(   ).   trim();

    let _ = hey("hheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyheyh"). trim().         trim().trim();
}

Codes like the above will not be formatted
long-strings-dont-prevent-formatting-expressions is not working

Cargo.toml

[package]
name = "example_rust"
version = "0.1.0"
edition = "2024"

[dependencies]

cargo fmt result

❯ cargo fmt --all --verbose
[bin (2024)] "/Users/mori/Desktop/example_rust/src/main.rs"
rustfmt --edition 2024 /Users/mori/Desktop/example_rust/src/main.rs
@ytmimi
Copy link
Contributor

ytmimi commented Feb 24, 2025

The docs could probably be updated to be a little clearer, but the reason this fails in this case is because of #3863.

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