Skip to content

Commit d4fe4c8

Browse files
committed
Auto merge of #113973 - matthiaskrgr:charstr, r=cjgillot
match on chars instead of &strs for .split() or .strip_prefix()
2 parents 699f4a6 + 7a77089 commit d4fe4c8

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compiler/rustc_hir_typeck/src/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
932932
var_hir_id: hir::HirId,
933933
closure_clause: hir::CaptureBy,
934934
) -> Option<FxIndexMap<UpvarMigrationInfo, UnordSet<&'static str>>> {
935-
let auto_traits_def_id = vec![
935+
let auto_traits_def_id = [
936936
self.tcx.lang_items().clone_trait(),
937937
self.tcx.lang_items().sync_trait(),
938938
self.tcx.get_diagnostic_item(sym::Send),

compiler/rustc_middle/src/traits/solve/inspect/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ struct Indentor<'a, 'b> {
1515

1616
impl Write for Indentor<'_, '_> {
1717
fn write_str(&mut self, s: &str) -> std::fmt::Result {
18-
for line in s.split_inclusive("\n") {
18+
for line in s.split_inclusive('\n') {
1919
if self.on_newline {
2020
self.f.write_str(" ")?;
2121
}
22-
self.on_newline = line.ends_with("\n");
22+
self.on_newline = line.ends_with('\n');
2323
self.f.write_str(line)?;
2424
}
2525

compiler/rustc_session/src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ impl LinkSelfContained {
279279
// set of all values like `y` or `n` used to be. Therefore, if this flag had previously been
280280
// set in bulk with its historical values, then manually setting a component clears that
281281
// `explicitly_set` state.
282-
if let Some(component_to_enable) = component.strip_prefix("+") {
282+
if let Some(component_to_enable) = component.strip_prefix('+') {
283283
self.explicitly_set = None;
284284
self.components.insert(component_to_enable.parse()?);
285285
Ok(())
286-
} else if let Some(component_to_disable) = component.strip_prefix("-") {
286+
} else if let Some(component_to_disable) = component.strip_prefix('-') {
287287
self.explicitly_set = None;
288288
self.components.remove(component_to_disable.parse()?);
289289
Ok(())

compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ mod parse {
11451145
}
11461146

11471147
// 2. Parse a list of enabled and disabled components.
1148-
for comp in s.split(",") {
1148+
for comp in s.split(',') {
11491149
if slot.handle_cli_component(comp).is_err() {
11501150
return false;
11511151
}

library/test/src/formatters/junit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn str_to_cdata(s: &str) -> String {
3232
let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
3333
let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
3434
// We also smuggle newlines as &#xa so as to keep all the output on one line
35-
let escaped_output = escaped_output.replace("\n", "]]>&#xA;<![CDATA[");
35+
let escaped_output = escaped_output.replace('\n', "]]>&#xA;<![CDATA[");
3636
// Prune empty CDATA blocks resulting from any escaping
3737
let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
3838
format!("<![CDATA[{}]]>", escaped_output)

0 commit comments

Comments
 (0)