diff options
Diffstat (limited to 'src/tools/clippy/src/docs/single_char_pattern.txt')
-rw-r--r-- | src/tools/clippy/src/docs/single_char_pattern.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/single_char_pattern.txt b/src/tools/clippy/src/docs/single_char_pattern.txt new file mode 100644 index 000000000..9e5ad1e7d --- /dev/null +++ b/src/tools/clippy/src/docs/single_char_pattern.txt @@ -0,0 +1,20 @@ +### What it does +Checks for string methods that receive a single-character +`str` as an argument, e.g., `_.split("x")`. + +### Why is this bad? +Performing these methods using a `char` is faster than +using a `str`. + +### Known problems +Does not catch multi-byte unicode characters. + +### Example +``` +_.split("x"); +``` + +Use instead: +``` +_.split('x'); +```
\ No newline at end of file |