Skip to content
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

More robust scanning for fmt argument expressions #337

Merged
merged 4 commits into from
Nov 2, 2024
Merged

More robust scanning for fmt argument expressions #337

merged 4 commits into from
Nov 2, 2024

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 2, 2024

Fixes #335.

    error[E0277]: `PathBuf` doesn't implement `std::fmt::Display`
       --> tests/test_expr.rs:105:14
        |
    104 |     #[derive(Error, Debug)]
        |              ----- in this derive macro expansion
    105 |     #[error("{A} {b}", b = &0 as &dyn Trait<i32, A = i32>)]
        |              ^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
        |
        = help: the trait `std::fmt::Display` is not implemented for `PathBuf`
        = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
        = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
        = note: this error originates in the macro `$crate::format_args` which comes from the expansion of the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
    warning: usage of wildcard import for enum variants
     --> impl/src/scan_expr.rs:1:12
      |
    1 | use self::{Action::*, Input::*};
      |            ^^^^^^^^^ help: try: `Action::{DecDepth, Finish, IncDepth, SetState}`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_glob_use
      = note: `-W clippy::enum-glob-use` implied by `-W clippy::pedantic`
      = help: to override `-W clippy::pedantic` add `#[allow(clippy::enum_glob_use)]`

    warning: usage of wildcard import for enum variants
     --> impl/src/scan_expr.rs:1:23
      |
    1 | use self::{Action::*, Input::*};
      |                       ^^^^^^^^ help: try: `Input::{CanBeginExpr, ConsumeAny, ConsumeBinOp, ConsumeBrace, ConsumeDelimiter, ConsumeIdent, ConsumeLifetime, ConsumeLiteral, ConsumeNestedBrace, Empty, ExpectPath, ExpectTurbofish, ExpectType, Keyword, Otherwise, Punct}`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_glob_use
@dtolnay dtolnay merged commit 851f694 into master Nov 2, 2024
18 checks passed
@dtolnay dtolnay deleted the scan branch November 2, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Associated type equality constraints interfere with display conversion
1 participant