Skip to content

Commit 43f2d70

Browse files
authored
Rollup merge of #78828 - matthiaskrgr:sing_chr, r=lcnr
use single char patterns for split() (clippy::single_char_pattern)
2 parents d290eb6 + 020ed65 commit 43f2d70

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_mir/src/transform/coverage/debug.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ impl DebugOptions {
147147
let mut counter_format = ExpressionFormat::default();
148148

149149
if let Ok(env_debug_options) = std::env::var(RUSTC_COVERAGE_DEBUG_OPTIONS) {
150-
for setting_str in env_debug_options.replace(" ", "").replace("-", "_").split(",") {
151-
let mut setting = setting_str.splitn(2, "=");
150+
for setting_str in env_debug_options.replace(" ", "").replace("-", "_").split(',') {
151+
let mut setting = setting_str.splitn(2, '=');
152152
match setting.next() {
153153
Some(option) if option == "allow_unused_expressions" => {
154154
allow_unused_expressions = bool_option_val(option, setting.next());
@@ -210,7 +210,7 @@ fn bool_option_val(option: &str, some_strval: Option<&str>) -> bool {
210210

211211
fn counter_format_option_val(strval: &str) -> ExpressionFormat {
212212
let mut counter_format = ExpressionFormat { id: false, block: false, operation: false };
213-
let components = strval.splitn(3, "+");
213+
let components = strval.splitn(3, '+');
214214
for component in components {
215215
match component {
216216
"id" => counter_format.id = true,
@@ -695,7 +695,7 @@ pub(crate) fn dump_coverage_graphviz(
695695
let from_bcb_data = &basic_coverage_blocks[from_bcb];
696696
let from_terminator = from_bcb_data.terminator(mir_body);
697697
let mut edge_labels = from_terminator.kind.fmt_successor_labels();
698-
edge_labels.retain(|label| label.to_string() != "unreachable");
698+
edge_labels.retain(|label| label != "unreachable");
699699
let edge_counters = from_terminator
700700
.successors()
701701
.map(|&successor_bb| graphviz_data.get_edge_counter(from_bcb, successor_bb));

compiler/rustc_mir/src/util/generic_graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<
174174
where
175175
W: Write,
176176
{
177-
let lines = label.split("\n").map(|s| dot::escape_html(s)).collect::<Vec<_>>();
177+
let lines = label.split('\n').map(|s| dot::escape_html(s)).collect::<Vec<_>>();
178178
let escaped_label = lines.join(r#"<br align="left"/>"#);
179179
writeln!(w, r#" label=<<br/><br/>{}<br align="left"/><br/><br/><br/>>;"#, escaped_label)
180180
}

0 commit comments

Comments
 (0)