Skip to content

Lint suggestion: Path construction using format! #8812

Open
@jplatte

Description

@jplatte

What it does

Suggest to create PathBufs using Path::join (or maybe PathBuf::push in some circumstances) instead of string formatting.

Lint Name

path_format

Category

suspicious

Example

PathBuf::from(format!("{}/foo/bar", base_path)); // or
PathBuf::from(format!("{}\\foo\\bar", base_ath));

could be written as

Path::new(base_path).join("foo").join("bar")

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions