---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
 --> FURB169.py:5:1
  |
3 | # Error.
4 |
5 | type(foo) is type(None)
  | ^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 | type(None) is type(foo)
  |
help: Replace with `is None`
  |
4 |
  - type(foo) is type(None)
5 + foo is None
6 |
  |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
 --> FURB169.py:7:1
  |
5 | type(foo) is type(None)
6 |
7 | type(None) is type(foo)
  | ^^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | type(None) is type(None)
  |
help: Replace with `is None`
  |
6 |
  - type(None) is type(foo)
7 + foo is None
8 |
  |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:9:1
   |
 7 | type(None) is type(foo)
 8 |
 9 | type(None) is type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | type(foo) is not type(None)
   |
help: Replace with `is None`
   |
8  |
   - type(None) is type(None)
9  + None is None
10 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:11:1
   |
 9 | type(None) is type(None)
10 |
11 | type(foo) is not type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | type(None) is not type(foo)
   |
help: Replace with `is not None`
   |
10 |
   - type(foo) is not type(None)
11 + foo is not None
12 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:13:1
   |
11 | type(foo) is not type(None)
12 |
13 | type(None) is not type(foo)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |
15 | type(None) is not type(None)
   |
help: Replace with `is not None`
   |
12 |
   - type(None) is not type(foo)
13 + foo is not None
14 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:15:1
   |
13 | type(None) is not type(foo)
14 |
15 | type(None) is not type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 |
17 | type(foo) == type(None)
   |
help: Replace with `is not None`
   |
14 |
   - type(None) is not type(None)
15 + None is not None
16 |
   |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:17:1
   |
15 | type(None) is not type(None)
16 |
17 | type(foo) == type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | type(None) == type(foo)
   |
help: Replace with `is None`
   |
16 |
   - type(foo) == type(None)
17 + foo is None
18 |
   |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:19:1
   |
17 | type(foo) == type(None)
18 |
19 | type(None) == type(foo)
   | ^^^^^^^^^^^^^^^^^^^^^^^
20 |
21 | type(None) == type(None)
   |
help: Replace with `is None`
   |
18 |
   - type(None) == type(foo)
19 + foo is None
20 |
   |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:21:1
   |
19 | type(None) == type(foo)
20 |
21 | type(None) == type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^
22 |
23 | type(foo) != type(None)
   |
help: Replace with `is None`
   |
20 |
   - type(None) == type(None)
21 + None is None
22 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:23:1
   |
21 | type(None) == type(None)
22 |
23 | type(foo) != type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^
24 |
25 | type(None) != type(foo)
   |
help: Replace with `is not None`
   |
22 |
   - type(foo) != type(None)
23 + foo is not None
24 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:25:1
   |
23 | type(foo) != type(None)
24 |
25 | type(None) != type(foo)
   | ^^^^^^^^^^^^^^^^^^^^^^^
26 |
27 | type(None) != type(None)
   |
help: Replace with `is not None`
   |
24 |
   - type(None) != type(foo)
25 + foo is not None
26 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:27:1
   |
25 | type(None) != type(foo)
26 |
27 | type(None) != type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^
28 |
29 | type(a.b) is type(None)
   |
help: Replace with `is not None`
   |
26 |
   - type(None) != type(None)
27 + None is not None
28 |
   |

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:29:1
   |
27 | type(None) != type(None)
28 |
29 | type(a.b) is type(None)
   | ^^^^^^^^^^^^^^^^^^^^^^^
30 |
31 | type(
   |
help: Replace with `is None`
   |
28 |
   - type(a.b) is type(None)
29 + a.b is None
30 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:31:1
   |
29 |   type(a.b) is type(None)
30 |
31 | / type(
32 | |     a(
33 | |         # Comment
34 | |     )
35 | | ) != type(None)
   | |_______________^
36 |
37 |   type(
   |
help: Replace with `is not None`
   |
30 |
   - type(
   -     a(
   -         # Comment
   -     )
   - ) != type(None)
31 + a() is not None
32 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB169 [*] When checking against `None`, use `is` instead of comparison with `type(None)`
  --> FURB169.py:37:1
   |
35 |   ) != type(None)
36 |
37 | / type(
38 | |     a := 1
39 | | ) == type(None)
   | |_______________^
40 |
41 |   type(
   |
help: Replace with `is None`
   |
36 |
   - type(
   -     a := 1
   - ) == type(None)
37 + (a := 1) is None
38 |
   |

FURB169 [*] When checking against `None`, use `is not` instead of comparison with `type(None)`
  --> FURB169.py:41:1
   |
39 |   ) == type(None)
40 |
41 | / type(
42 | |     a for a in range(0)
43 | | ) is not type(None)
   | |___________________^
   |
help: Replace with `is not None`
   |
40 |
   - type(
   -     a for a in range(0)
   - ) is not type(None)
41 + (a for a in range(0)) is not None
42 |
   |
