RS.CLIPPY.SINGLE_CHAR_ADD_STR

`push_str()` or `insert_str()` used with a single-character string literal as parameter

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: single_char_add_str. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Warns when using push_str/insert_str with a single-character string literal where push/insert with a char would work fine.

Why is this bad?

It's less clear that we are pushing a single character.

Example

string.insert_str(0, "R");
string.push_str("R");

Use instead:

string.insert(0, \'R\');
string.push(\'R\');

Past names

  • single_char_push_str