Skip to content

feature flag if not being taken into consideration #8784

@WhyNotHugo

Description

@WhyNotHugo

Summary

Code is here -> https://github.com/librespot-org/librespot/blob/650d41b020691fec6c7d2c90c0f6de91ac8635cf/discovery/src/lib.rs#L103-L126

For this block:

 let svc; cfg_if! { if #[cfg(feature = "with-dns-sd")] { svc = dns_sd::DNSService::register( Some(name.as_ref()), "_spotify-connect._tcp", None, None, port, &["VERSION=1.0", "CPath=/"], ) .unwrap(); } else { let responder = libmdns::Responder::spawn(&tokio::runtime::Handle::current())?; svc = responder.register( "_spotify-connect._tcp".to_owned(), name, port, &["VERSION=1.0", "CPath=/"], ) } };

clippy reports unneeded late initalization. I think it can't "see" the that this feature-based if exists due to how the macro works.

Lint Name

needless_late_init

Version

rustc 1.60.0 (7737e0b5c 2022-04-04) binary: rustc commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c commit-date: 2022-04-04 host: x86_64-unknown-linux-gnu release: 1.60.0 LLVM version: 14.0.0 

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions