rust-bitcoin / rust-bitcoincore-rpc

Rust RPC client library for the Bitcoin Core JSON-RPC API.
340 stars 255 forks source link

Found single-character string literal pattern #335

Closed philipjonsen closed 1 month ago

philipjonsen commented 7 months ago

DESCRIPTION:

Certain str functions, such as .split() and .find() work on patterns that accept both string literals as well as characters. When using such functions, prefer chars over single-character string literals as they are more performant.

Replace the single-character string literal with a char.

BAD PRACTICE let x = "hello, world"; x.find("o"); // single-character str

RECOMMENDED let x = "hello, world"; x.find('o'); // use a char instead

rust-bitcoincore-rpc/blob/master/client/src/client.rs#L212-L212

TheBlueMatt commented 7 months ago

Why open an issue for this rather than just a PR?

apoelstra commented 1 month ago

This is a dupe of https://github.com/rust-bitcoin/rust-bitcoincore-rpc/issues/336

Not sure why these are in my notifications now. But I blocked the user who posted them from this repo