---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:1:5
  |
1 | _ = lambda: print()  # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^
2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda]
  |
help: Inline function call
  |
  - _ = lambda: print()  # [unnecessary-lambda]
1 + _ = print  # [unnecessary-lambda]
2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda]
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:2:5
  |
1 | _ = lambda: print()  # [unnecessary-lambda]
2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^^^^^^^^
3 |
4 | _ = lambda *args: f(*args) # [unnecessary-lambda]
  |
help: Inline function call
  |
1 | _ = lambda: print()  # [unnecessary-lambda]
  - _ = lambda x, y: min(x, y) # [unnecessary-lambda]
2 + _ = min # [unnecessary-lambda]
3 |
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:4:5
  |
2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda]
3 |
4 | _ = lambda *args: f(*args) # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^^^^^^^^
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
  |
help: Inline function call
  |
3 |
  - _ = lambda *args: f(*args) # [unnecessary-lambda]
4 + _ = f # [unnecessary-lambda]
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:5:5
  |
4 | _ = lambda *args: f(*args) # [unnecessary-lambda]
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
  |
help: Inline function call
  |
4 | _ = lambda *args: f(*args) # [unnecessary-lambda]
  - _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
5 + _ = f # [unnecessary-lambda]
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:6:5
  |
4 | _ = lambda *args: f(*args) # [unnecessary-lambda]
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
  |
help: Inline function call
  |
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
  - _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
6 + _ = f # [unnecessary-lambda]
7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
 --> unnecessary_lambda.py:7:5
  |
5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda]
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda]
  |
help: Inline function call
  |
6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda]
  - _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
7 + _ = f # [unnecessary-lambda]
8 |
  |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
  --> unnecessary_lambda.py:9:5
   |
 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda]
 8 |
 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda]
   |
help: Inline function call
   |
8  |
   - _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda]
9  + _ = f(lambda x: x) # [unnecessary-lambda]
10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda]
   |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
  --> unnecessary_lambda.py:10:5
   |
 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda]
10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 |
12 | # default value in lambda parameters
   |
help: Inline function call
   |
9  | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda]
   - _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda]
10 + _ = f(lambda x, y: x + y) # [unnecessary-lambda]
11 |
   |
note: This is an unsafe fix and may change runtime behavior

PLW0108 [*] Lambda may be unnecessary; consider inlining inner function
  --> unnecessary_lambda.py:62:5
   |
61 | # https://github.com/astral-sh/ruff/issues/18675
62 | _ = lambda x: (string := str)(x)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 | _ = lambda x: ((x := 1) and str)(x)
   |
help: Inline function call
   |
61 | # https://github.com/astral-sh/ruff/issues/18675
   - _ = lambda x: (string := str)(x)
62 + _ = (string := str)
63 | _ = lambda x: ((x := 1) and str)(x)
   |
note: This is an unsafe fix and may change runtime behavior

PLW0108 Lambda may be unnecessary; consider inlining inner function
  --> unnecessary_lambda.py:63:5
   |
61 | # https://github.com/astral-sh/ruff/issues/18675
62 | _ = lambda x: (string := str)(x)
63 | _ = lambda x: ((x := 1) and str)(x)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Inline function call
