A parameter of a private method or local function is never used
What it finds
A parameter that the body never reads makes every caller compute and pass a value for nothing, and suggests that the method does something with it. For private methods and local functions the parameter can simply be removed. Methods with an empty body, handler shapes with an EventArgs parameter, and discards named _ are left alone.
From the rule's source, unused_parameter.rs.
class Formatter{ public string Run(int a) => Format(a, 2); private string Format(int value, int width)tx0 reports: the parameter width is never used { return value.ToString(); }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:unused-parameter" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:unused-parameter] reason="..."tx0 explain tx0/csharp:unused-parameter shows the same in the terminal. Found a false positive? Report it.