Skip to content

The file path in the diagnostic message contains duplicate separators on windows #14227

@ahaoboy

Description

@ahaoboy

Problem

When using a relative path in a workspace subproject, the file path in the diagnostic message contains duplicate separators

happened

mpv-easy-ext\./src/main.rs:2:7

expected

mpv-easy-ext/src/main.rs:2:7
 cargo clippy
    Checking mpv-easy-ext v0.1.0 (C:\wt\clippy-path\mpv-easy-ext)
warning: unused variable: `a`
 --> mpv-easy-ext\./src/main.rs:2:7
  |
2 |   let a = 1;
  |       ^ help: if this is intentional, prefix it with an underscore: `_a`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: `mpv-easy-ext` (bin "mpv") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s

Steps

git clone https://github.com/ahaoboy/cargo-clippy-path

cd cargo-clippy-path

cargo clippy

Possible Solution(s)

Use clean-path to transform the output path

Notes

No response

Version

cargo 1.81.0-nightly (154fdac39 2024-07-07)
release: 1.81.0-nightly
commit-hash: 154fdac39ae9629954e19e9986fd2cf2cdd8d964
commit-date: 2024-07-07
host: x86_64-pc-windows-msvc
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.8.0-DEV (sys:0.4.73+curl-8.8.0 vendored ssl:Schannel)
os: Windows 10.0.22635 (Windows 11 Professional) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)A-console-outputArea: Terminal output, colors, progress bar, etc.C-bugCategory: bugO-windowsOS: WindowsS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions