---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP045 [*] Use `X | None` for type annotations
 --> UP045_2.py:5:10
  |
5 | def f(x: Optional[str]) -> None:
  |          ^^^^^^^^^^^^^
6 |     ...
  |
help: Convert to `X | None`
  |
4 |
  - def f(x: Optional[str]) -> None:
5 + def f(x: str | None) -> None:
6 |     ...
  |

UP045 [*] Use `X | None` for type annotations
  --> UP045_2.py:9:10
   |
 9 | def f(x: typing.Optional[str]) -> None:
   |          ^^^^^^^^^^^^^^^^^^^^
10 |     ...
   |
help: Convert to `X | None`
   |
8  |
   - def f(x: typing.Optional[str]) -> None:
9  + def f(x: str | None) -> None:
10 |     ...
   |
