0

When I add the reqwest dependency reqwest = { version = "0.11", features = ["json"] } I start getting an unresolved reference: Result for any Result object fn foo() -> Result<>{} in main.rs. If I remove the "reqwest" dependency, the errors disappear. Any reasons this could happen? I'm using rustc 1.67.0-nightly.

Edit: The code compiles properly, but the code editor says 'unresolved reference: Result' and 'Result' is hilighted in red. So maybe an issue with the IDE? I'm using Pycharm.

main.rs

use std::error::Error;


fn foo() -> Result<(), Box<dyn Error>>{Ok(())}

fn main() {
    println!("Hello, world!");
}

cargo.toml

[package]
name = "AoC2021"
version = "0.1.0"
edition = "2021"

[dependencies]
reqwest = { version = "0.11", features = ["json"] }
juju
  • 884
  • 1
  • 9
  • 31
  • A reproducible example please? – Chayim Friedman Nov 24 '22 at 06:26
  • Your code gives "error[E0308]: mismatched types" not a reference error cause you don't return an `Ok(())` or `Err` variant. After I add that, it shows a few warnings about a bad crate name & an unused function but still no reference error. – cafce25 Nov 24 '22 at 06:50
  • @cafce25 I edited my question and returned Ok(()). Seems to be an IDE issue maybe. I'm able to compile the code now but the IDE still shows it as an error for some reason – juju Nov 24 '22 at 07:00
  • 1
    Is the `rust-analyzer` (or what you use instead) you use from your IDE up to date with the rust version you're compiling with? – cafce25 Nov 24 '22 at 07:25

0 Answers0