Skip to content

Long strings prevent formatting method syntax on edition 2024 #6480

Closed as duplicate of#3863
@moriyoshi-kasuga

Description

@moriyoshi-kasuga
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions