Skip to content

Spurious reference binding from edition lint #87355

Closed
@djc

Description

@djc

I ran cargo +nightly fix --edition against quinn-rs/quinn@a21f010.

I expected to see this happen: no changes or necessary edition-related changes.

Instead, this happened: cargo fix produced this change:

djc-2019 main quinn $ git diff
diff --git a/quinn/examples/client.rs b/quinn/examples/client.rs
index f310b461..033b1c1e 100644
--- a/quinn/examples/client.rs
+++ b/quinn/examples/client.rs
@@ -60,7 +60,7 @@ fn main() {
 }
 
 #[tokio::main]
-async fn run(options: Opt) -> Result<()> {
+async fn run(options: Opt) -> Result<()> { let _ = &options; 
     let url = options.url;
     let remote = (url.host_str().unwrap(), url.port().unwrap_or(4433))
         .to_socket_addrs()?

(The formatting is surprising, but that's not what this issue is about.)

cargo +nightly c with cargo-features = ["edition2021"] seems to work with or without the change, so it seems like this change is not actually needed. Is there some odd interaction with tokio::main?

Meta

rustc 1.55.0-nightly (b41936b 2021-07-20)
binary: rustc
commit-hash: b41936b
commit-date: 2021-07-20
host: x86_64-apple-darwin
release: 1.55.0-nightly
LLVM version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2021Area: The 2021 editionC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions