string.Format is given a format string without placeholders and no arguments

tx0/csharp:format-without-placeholdersstrictwarningstyle/conventionsdepth faststyle

What it finds

Without placeholders or arguments, string.Format("text") returns its argument, after parsing it; braces in it still have to be doubled. The literal alone says the same.

From the rule's source, format_without_placeholders.rs.

Example from the rule's tests
class Messages{    string Hello() => string.Format("hello");tx0 reports: string.Format has nothing to format     string Named(string n) => string.Format("hello {0}", n);}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/csharp:format-without-placeholders" = "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:format-without-placeholders] reason="..."

tx0 explain tx0/csharp:format-without-placeholders shows the same in the terminal. Found a false positive? Report it.