Skip to content

Invalid format string detection is over-eager #16

@coriolinus

Description

@coriolinus

Example

// for purposes of this example, this struct is defined in an external crate and cannot be modified.
#[derive(Debug)]
struct Point {
    x: i32,
    y: i32,
}

// therefore, this wrapper exists to add `FromStr` and `Display` implementations.
#[derive(Debug, parse_display::FromStr, parse_display::Display)]
#[display("<{0.x}, {0.y}>")]
struct PointWrapper(Point);

Expected Behavior

As all fields of the wrapped type are specified, no error occurs.

Observed Behavior

error: field `0` is not appear in format.
 --> src/main.rs:8:11
  |
8 | #[display("<{0.x}, {0.y}>")]
  |           ^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions