intellij-rust icon indicating copy to clipboard operation
intellij-rust copied to clipboard

False-positive "x doesn't implement `Display` (required by {})"

Open s-titov opened this issue 2 years ago • 1 comments

Environment

  • IntelliJ Rust plugin version: 0.4.194.5382-231
  • Rust toolchain version: rustc 1.69.0 (84c898d65 2023-04-16)
  • IDE name and version: Goland 2023.1.2
  • Operating system: Windows 11

Problem description

I've implemented fmt::Display for Point2D and it works, but IDE still shows me error.

image

Steps to reproduce

use std::fmt;

struct Point2D {
    x: f64,
    y: f64,
}

impl fmt::Display for Point2D {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "x: {}, y: {}", self.x, self.y)
    }
}

fn main() {
    let point = Point2D { x: 3.3, y: 7.2 };
    println!("Display: {}", point);
}

s-titov avatar May 27 '23 14:05 s-titov

I have observed this consistently happening when I add a local crate as a dependency. Everything compiles fine, however the IDE only recognizes the type and not the implementation of Display, or any implemented method for that matter.

  • Rustc / cargo: 1.72.0
  • Rust Plugin: 0.4.200.5421-232
  • CLion 2023.2.1
  • Manjaro Linux

asorgejr avatar Sep 11 '23 20:09 asorgejr