Skip to content

Mismatch between comment and actual code about when paths are made relative #715

Description

@bjorn3

The comment says it is done only for the short format:

backtrace-rs/src/capture.rs

Lines 493 to 496 in 57c7529

// When printing paths we try to strip the cwd if it exists, otherwise
// we just print the path as-is. Note that we also only do this for the
// short format, because if it's full we presumably want to print
// everything.
Which matches the printing code in libstd. The actual code however does it for the full format:

backtrace-rs/src/capture.rs

Lines 501 to 507 in 57c7529

if style == PrintFmt::Full {
if let Ok(cwd) = &cwd {
if let Ok(suffix) = path.strip_prefix(cwd) {
return fmt::Display::fmt(&suffix.display(), fmt);
}
}
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions