Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Incorrect "expected 1 argument, found 0" in Rust Analyzer
Hello all.
I've been programming Rust for a while now and have recently encountered an issue with Rust Analyzer that I can't seem to find a solution for. So, I wanted to post it here to see if other people are facing the same issue.
I'm using the tracing
crate in my codebase to do all logging and events. I have statements such as the following in my code:
tracing::trace!("{label} - PRE STATE:");
The above statement looks correct to me syntactically in terms of how it does the tracing. However, Rust Analyzer doesn't seem to like it as I get a diagnostics error for this line saying:
expected 1 argument, found 0 rust-analyzer (E0107)
Despite that, running cargo check
, cargo clippy
, and cargo build
all work just fine (even when I set the logging level to trace through my env vars) despite Rust Analyzer saying that the above line contains an error.
I have tried the following:
cargo clean
.I'm currently using version 0.4.2542
of Rust Analyzer from the VS Code extension store. Has anyone encountered this issue before? I really do not want to turn diagnostics off, but it's getting kind of hard coding in the codebase when all of the tracing statements are seen as errors by RA.
Currently, the only fix I found for this is to disable this specific diagnostic completely in the RA settings like the following:
{
"rust-analyzer.diagnostics.disabled": [
"E0107"
]
}
Which is less than ideal as it's still a useful error to have when it works.
1 post - 1 participant
🏷️ rust_feed