about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-23 10:12:40 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-07-23 10:13:41 +0200
commit7a7708904bf69c8f85a41efea1db4cd5ebc6fecb (patch)
tree68f28315b7128a6fdcf28f8d851ba66028fca7b8
parentcec34a43b1b14f4e39363f3b283d7ac4f593ee81 (diff)
downloadrust-7a7708904bf69c8f85a41efea1db4cd5ebc6fecb.tar.gz
rust-7a7708904bf69c8f85a41efea1db4cd5ebc6fecb.zip
match on chars instead of &strs for .split() or .strip_prefix()
-rw-r--r--compiler/rustc_hir_typeck/src/upvar.rs2
-rw-r--r--compiler/rustc_middle/src/traits/solve/inspect/format.rs4
-rw-r--r--compiler/rustc_session/src/config.rs4
-rw-r--r--compiler/rustc_session/src/options.rs2
-rw-r--r--library/test/src/formatters/junit.rs2
5 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs
index fb81a8395d7..22fe823acb7 100644
--- a/compiler/rustc_hir_typeck/src/upvar.rs
+++ b/compiler/rustc_hir_typeck/src/upvar.rs
@@ -932,7 +932,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         var_hir_id: hir::HirId,
         closure_clause: hir::CaptureBy,
     ) -> Option<FxIndexMap<UpvarMigrationInfo, UnordSet<&'static str>>> {
-        let auto_traits_def_id = vec![
+        let auto_traits_def_id = [
             self.tcx.lang_items().clone_trait(),
             self.tcx.lang_items().sync_trait(),
             self.tcx.get_diagnostic_item(sym::Send),
diff --git a/compiler/rustc_middle/src/traits/solve/inspect/format.rs b/compiler/rustc_middle/src/traits/solve/inspect/format.rs
index f19f1189e44..d0d2080b6a1 100644
--- a/compiler/rustc_middle/src/traits/solve/inspect/format.rs
+++ b/compiler/rustc_middle/src/traits/solve/inspect/format.rs
@@ -15,11 +15,11 @@ struct Indentor<'a, 'b> {
 
 impl Write for Indentor<'_, '_> {
     fn write_str(&mut self, s: &str) -> std::fmt::Result {
-        for line in s.split_inclusive("\n") {
+        for line in s.split_inclusive('\n') {
             if self.on_newline {
                 self.f.write_str("    ")?;
             }
-            self.on_newline = line.ends_with("\n");
+            self.on_newline = line.ends_with('\n');
             self.f.write_str(line)?;
         }
 
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index a8147ede970..36b5c385ab1 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -279,11 +279,11 @@ impl LinkSelfContained {
         // set of all values like `y` or `n` used to be. Therefore, if this flag had previously been
         // set in bulk with its historical values, then manually setting a component clears that
         // `explicitly_set` state.
-        if let Some(component_to_enable) = component.strip_prefix("+") {
+        if let Some(component_to_enable) = component.strip_prefix('+') {
             self.explicitly_set = None;
             self.components.insert(component_to_enable.parse()?);
             Ok(())
-        } else if let Some(component_to_disable) = component.strip_prefix("-") {
+        } else if let Some(component_to_disable) = component.strip_prefix('-') {
             self.explicitly_set = None;
             self.components.remove(component_to_disable.parse()?);
             Ok(())
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 39efe9abeec..ff433fdf16d 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -1145,7 +1145,7 @@ mod parse {
         }
 
         // 2. Parse a list of enabled and disabled components.
-        for comp in s.split(",") {
+        for comp in s.split(',') {
             if slot.handle_cli_component(comp).is_err() {
                 return false;
             }
diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs
index 9f5bf24367e..a211ebf1ded 100644
--- a/library/test/src/formatters/junit.rs
+++ b/library/test/src/formatters/junit.rs
@@ -32,7 +32,7 @@ fn str_to_cdata(s: &str) -> String {
     let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
     let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
     // We also smuggle newlines as &#xa so as to keep all the output on one line
-    let escaped_output = escaped_output.replace("\n", "]]>&#xA;<![CDATA[");
+    let escaped_output = escaped_output.replace('\n', "]]>&#xA;<![CDATA[");
     // Prune empty CDATA blocks resulting from any escaping
     let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
     format!("<![CDATA[{}]]>", escaped_output)