refurb
refurb copied to clipboard
[Bug]: FURB111 triggers for lambdas returning constants which are not the default of the built-in
Has your issue already been fixed?
- [x] Have you checked to see if your issue still exists on the
masterbranch? See the docs for instructions on how to setup a local build of Refurb. - [x] Have you looked at the open/closed issues to see if anyone has already reported your issue?
- [x] If reporting a false positive/incorrect suggestion, have you double checked that the suggested fix changes the code semantics?
The Bug
The following code:
from typing import Callable
def func(x: Callable):
x()
func(lambda: False)
Emits the following error:
$ refurb foo.py
[# Some error here](foo.py:5:6 [FURB111]: Replace `lambda: False` with `bool`)
But it should not be emitting an error instance because here a callable is needed
Version Info
Refurb: v2.0.0
Mypy: v1.10.0
Python Version
Python 3.12.0
Config File
# N/A
Extra Info
None