"clippy::single_component_path_imports" False positive on swapped namespaces to enable mocking. #11925
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Uh oh!
There was an error while loading. Please reload this page.
Summary
Imagine you have a 3rd part dependency on module
module3
.My component depends on an exported member from that namespace, for example,
module3::Foo
.I want to test my component's internal logic without instantiating
module3::Foo
.To do so, I mock
module3::Foo
withmockall
. I will nowuse module3
for actual builds, whileuse mock::module3 as module3
for test builds.Lint
single_component_path_imports
is going to complain about my firstuse
.Lint Name
single_component_path_imports
Reproducer
I tried this code:
I saw this happen:
I do not know if it is reasonable to expect the lint to deduce that the namespaces are swapped. However it definitely produces a warning where I did not expect it.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: