about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-02-26 13:03:46 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-02-27 14:57:22 +0100
commit7c84ba112429eb9bc0b99a6fe32a453c920a764c (patch)
tree98a44856b3d3b0792b8c9726b34cbbb5a7f34c67
parenta8437cf213ac1e950b6f5c691c4d2a29bf949bcd (diff)
downloadrust-7c84ba112429eb9bc0b99a6fe32a453c920a764c.tar.gz
rust-7c84ba112429eb9bc0b99a6fe32a453c920a764c.zip
use char instead of &str for single char patterns
-rw-r--r--src/librustc_builtin_macros/asm.rs8
-rw-r--r--src/librustc_builtin_macros/format.rs2
-rw-r--r--src/librustc_codegen_llvm/back/lto.rs2
-rw-r--r--src/librustc_codegen_utils/link.rs2
-rw-r--r--src/librustc_driver/args.rs2
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_expand/proc_macro_server.rs4
-rw-r--r--src/librustc_hir/hir.rs2
-rw-r--r--src/librustc_incremental/assert_module_sources.rs2
-rw-r--r--src/librustc_incremental/persist/fs.rs6
-rw-r--r--src/librustc_interface/util.rs2
-rw-r--r--src/librustc_llvm/build.rs2
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/region_errors.rs2
-rw-r--r--src/librustc_mir/borrow_check/mod.rs2
-rw-r--r--src/librustc_mir/transform/mod.rs2
-rw-r--r--src/librustc_parse/parser/expr.rs2
-rw-r--r--src/librustc_passes/dead.rs2
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs2
-rw-r--r--src/librustc_resolve/lib.rs2
-rw-r--r--src/librustc_target/abi/mod.rs6
-rw-r--r--src/librustc_typeck/astconv.rs2
-rw-r--r--src/librustc_typeck/check/demand.rs4
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/librustc_typeck/check/op.rs6
-rw-r--r--src/librustc_typeck/collect.rs4
-rw-r--r--src/librustdoc/html/markdown.rs2
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/html/render/cache.rs4
-rw-r--r--src/librustdoc/markdown.rs2
-rw-r--r--src/libstd/io/mod.rs4
30 files changed, 44 insertions, 44 deletions
diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/asm.rs
index 4723544316f..9f98cf253c9 100644
--- a/src/librustc_builtin_macros/asm.rs
+++ b/src/librustc_builtin_macros/asm.rs
@@ -182,7 +182,7 @@ fn parse_inline_asm<'a>(
                     };
 
                     let is_rw = output.is_some();
-                    let is_indirect = constraint_str.contains("*");
+                    let is_indirect = constraint_str.contains('*');
                     outputs.push(ast::InlineAsmOutput {
                         constraint: output.unwrap_or(constraint),
                         expr,
@@ -199,7 +199,7 @@ fn parse_inline_asm<'a>(
 
                     let constraint = parse_asm_str(&mut p)?;
 
-                    if constraint.as_str().starts_with("=") {
+                    if constraint.as_str().starts_with('=') {
                         struct_span_err!(
                             cx.parse_sess.span_diagnostic,
                             p.prev_span,
@@ -207,7 +207,7 @@ fn parse_inline_asm<'a>(
                             "input operand constraint contains '='"
                         )
                         .emit();
-                    } else if constraint.as_str().starts_with("+") {
+                    } else if constraint.as_str().starts_with('+') {
                         struct_span_err!(
                             cx.parse_sess.span_diagnostic,
                             p.prev_span,
@@ -234,7 +234,7 @@ fn parse_inline_asm<'a>(
 
                     if OPTIONS.iter().any(|&opt| s == opt) {
                         cx.span_warn(p.prev_span, "expected a clobber, found an option");
-                    } else if s.as_str().starts_with("{") || s.as_str().ends_with("}") {
+                    } else if s.as_str().starts_with('{') || s.as_str().ends_with('}') {
                         struct_span_err!(
                             cx.parse_sess.span_diagnostic,
                             p.prev_span,
diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs
index a9298abe2d7..e1d30674186 100644
--- a/src/librustc_builtin_macros/format.rs
+++ b/src/librustc_builtin_macros/format.rs
@@ -894,7 +894,7 @@ pub fn expand_preparsed_format_args(
     };
 
     let (is_literal, fmt_snippet) = match ecx.source_map().span_to_snippet(fmt_sp) {
-        Ok(s) => (s.starts_with("\"") || s.starts_with("r#"), Some(s)),
+        Ok(s) => (s.starts_with('"') || s.starts_with("r#"), Some(s)),
         _ => (false, None),
     };
 
diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs
index d7297ed4176..6b136aeb8d9 100644
--- a/src/librustc_codegen_llvm/back/lto.rs
+++ b/src/librustc_codegen_llvm/back/lto.rs
@@ -917,7 +917,7 @@ impl ThinLTOImports {
             if line.is_empty() {
                 let importing_module = current_module.take().expect("Importing module not set");
                 imports.insert(importing_module, mem::replace(&mut current_imports, vec![]));
-            } else if line.starts_with(" ") {
+            } else if line.starts_with(' ') {
                 // Space marks an imported module
                 assert_ne!(current_module, None);
                 current_imports.push(line.trim().to_string());
diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs
index 4dab4545b42..92cbc42388d 100644
--- a/src/librustc_codegen_utils/link.rs
+++ b/src/librustc_codegen_utils/link.rs
@@ -78,7 +78,7 @@ pub fn find_crate_name(sess: Option<&Session>, attrs: &[ast::Attribute], input:
     }
     if let Input::File(ref path) = *input {
         if let Some(s) = path.file_stem().and_then(|s| s.to_str()) {
-            if s.starts_with("-") {
+            if s.starts_with('-') {
                 let msg = format!(
                     "crate names cannot start with a `-`, but \
                                    `{}` has a leading hyphen",
diff --git a/src/librustc_driver/args.rs b/src/librustc_driver/args.rs
index 5e2c43596db..5686819c61b 100644
--- a/src/librustc_driver/args.rs
+++ b/src/librustc_driver/args.rs
@@ -4,7 +4,7 @@ use std::fs;
 use std::io;
 
 pub fn arg_expand(arg: String) -> Result<Vec<String>, Error> {
-    if arg.starts_with("@") {
+    if arg.starts_with('@') {
         let path = &arg[1..];
         let file = match fs::read_to_string(path) {
             Ok(file) => file,
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index f68ea7e0770..410439360d7 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -521,7 +521,7 @@ fn stdout_isatty() -> bool {
 
 fn handle_explain(registry: Registry, code: &str, output: ErrorOutputType) {
     let normalised =
-        if code.starts_with("E") { code.to_string() } else { format!("E{0:0>4}", code) };
+        if code.starts_with('E') { code.to_string() } else { format!("E{0:0>4}", code) };
     match registry.find_description(&normalised) {
         Some(ref description) => {
             let mut is_in_code_block = false;
diff --git a/src/librustc_expand/proc_macro_server.rs b/src/librustc_expand/proc_macro_server.rs
index a7397e576b1..21fd4449307 100644
--- a/src/librustc_expand/proc_macro_server.rs
+++ b/src/librustc_expand/proc_macro_server.rs
@@ -209,7 +209,7 @@ impl ToInternal<TokenStream> for TokenTree<Group, Punct, Ident, Literal> {
             TokenTree::Literal(self::Literal {
                 lit: token::Lit { kind: token::Integer, symbol, suffix },
                 span,
-            }) if symbol.as_str().starts_with("-") => {
+            }) if symbol.as_str().starts_with('-') => {
                 let minus = BinOp(BinOpToken::Minus);
                 let symbol = Symbol::intern(&symbol.as_str()[1..]);
                 let integer = TokenKind::lit(token::Integer, symbol, suffix);
@@ -220,7 +220,7 @@ impl ToInternal<TokenStream> for TokenTree<Group, Punct, Ident, Literal> {
             TokenTree::Literal(self::Literal {
                 lit: token::Lit { kind: token::Float, symbol, suffix },
                 span,
-            }) if symbol.as_str().starts_with("-") => {
+            }) if symbol.as_str().starts_with('-') => {
                 let minus = BinOp(BinOpToken::Minus);
                 let symbol = Symbol::intern(&symbol.as_str()[1..]);
                 let float = TokenKind::lit(token::Float, symbol, suffix);
diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs
index 6d2f5ba6baf..ab3368d0a49 100644
--- a/src/librustc_hir/hir.rs
+++ b/src/librustc_hir/hir.rs
@@ -1496,7 +1496,7 @@ pub fn is_range_literal(sm: &SourceMap, expr: &Expr<'_>) -> bool {
         let end_point = sm.end_point(*span);
 
         if let Ok(end_string) = sm.span_to_snippet(end_point) {
-            !(end_string.ends_with("}") || end_string.ends_with(")"))
+            !(end_string.ends_with('}') || end_string.ends_with(')'))
         } else {
             false
         }
diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs
index 70abb38278a..293815cb52d 100644
--- a/src/librustc_incremental/assert_module_sources.rs
+++ b/src/librustc_incremental/assert_module_sources.rs
@@ -107,7 +107,7 @@ impl AssertModuleSource<'tcx> {
         }
 
         // Split of the "special suffix" if there is one.
-        let (user_path, cgu_special_suffix) = if let Some(index) = user_path.rfind(".") {
+        let (user_path, cgu_special_suffix) = if let Some(index) = user_path.rfind('.') {
             (&user_path[..index], Some(&user_path[index + 1..]))
         } else {
             (&user_path[..], None)
diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs
index ba20006d73c..8548ad392d2 100644
--- a/src/librustc_incremental/persist/fs.rs
+++ b/src/librustc_incremental/persist/fs.rs
@@ -152,7 +152,7 @@ pub fn lock_file_path(session_dir: &Path) -> PathBuf {
     let directory_name = session_dir.file_name().unwrap().to_string_lossy();
     assert_no_characters_lost(&directory_name);
 
-    let dash_indices: Vec<_> = directory_name.match_indices("-").map(|(idx, _)| idx).collect();
+    let dash_indices: Vec<_> = directory_name.match_indices('-').map(|(idx, _)| idx).collect();
     if dash_indices.len() != 3 {
         bug!(
             "Encountered incremental compilation session directory with \
@@ -342,7 +342,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Svh) {
 
     // Keep the 's-{timestamp}-{random-number}' prefix, but replace the
     // '-working' part with the SVH of the crate
-    let dash_indices: Vec<_> = old_sub_dir_name.match_indices("-").map(|(idx, _)| idx).collect();
+    let dash_indices: Vec<_> = old_sub_dir_name.match_indices('-').map(|(idx, _)| idx).collect();
     if dash_indices.len() != 3 {
         bug!(
             "Encountered incremental compilation session directory with \
@@ -594,7 +594,7 @@ fn extract_timestamp_from_session_dir(directory_name: &str) -> Result<SystemTime
         return Err(());
     }
 
-    let dash_indices: Vec<_> = directory_name.match_indices("-").map(|(idx, _)| idx).collect();
+    let dash_indices: Vec<_> = directory_name.match_indices('-').map(|(idx, _)| idx).collect();
     if dash_indices.len() != 3 {
         return Err(());
     }
diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs
index c73f7aafb48..f29a2609af4 100644
--- a/src/librustc_interface/util.rs
+++ b/src/librustc_interface/util.rs
@@ -244,7 +244,7 @@ pub fn get_codegen_backend(sess: &Session) -> Box<dyn CodegenBackend> {
             .as_ref()
             .unwrap_or(&sess.target.target.options.codegen_backend);
         let backend = match &codegen_name[..] {
-            filename if filename.contains(".") => load_backend_from_dylib(filename.as_ref()),
+            filename if filename.contains('.') => load_backend_from_dylib(filename.as_ref()),
             codegen_name => get_builtin_codegen_backend(codegen_name),
         };
 
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 405ce0307cd..9b4f03b3fb6 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -178,7 +178,7 @@ fn main() {
     for lib in output(&mut cmd).split_whitespace() {
         let name = if lib.starts_with("-l") {
             &lib[2..]
-        } else if lib.starts_with("-") {
+        } else if lib.starts_with('-') {
             &lib[1..]
         } else if Path::new(lib).exists() {
             // On MSVC llvm-config will print the full name to libraries, but
diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
index 8d991927d54..8cd75d4a2fd 100644
--- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
@@ -612,7 +612,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
                         } else {
                             "'_".to_string()
                         };
-                        let suggestion = if snippet.ends_with(";") {
+                        let suggestion = if snippet.ends_with(';') {
                             // `type X = impl Trait;`
                             format!("{} + {};", &snippet[..snippet.len() - 1], suggestable_fr_name)
                         } else {
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index a3edfb662c5..f5640f25004 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -365,7 +365,7 @@ fn do_mir_borrowck<'a, 'tcx>(
         // Skip over locals that begin with an underscore or have no name
         match mbcx.local_names[local] {
             Some(name) => {
-                if name.as_str().starts_with("_") {
+                if name.as_str().starts_with('_') {
                     continue;
                 }
             }
diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs
index 3c37eccc184..c4588d5fb03 100644
--- a/src/librustc_mir/transform/mod.rs
+++ b/src/librustc_mir/transform/mod.rs
@@ -122,7 +122,7 @@ impl<'tcx> MirSource<'tcx> {
 /// type `T`.
 pub fn default_name<T: ?Sized>() -> Cow<'static, str> {
     let name = ::std::any::type_name::<T>();
-    if let Some(tail) = name.rfind(":") { Cow::from(&name[tail + 1..]) } else { Cow::from(name) }
+    if let Some(tail) = name.rfind(':') { Cow::from(&name[tail + 1..]) } else { Cow::from(name) }
 }
 
 /// A streamlined trait that you can implement to create a pass; the
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 3ae97ed5f88..a46d4cceeb2 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -758,7 +758,7 @@ impl<'a> Parser<'a> {
                 s.print_usize(float.trunc() as usize);
                 s.pclose();
                 s.s.word(".");
-                s.s.word(fstr.splitn(2, ".").last().unwrap().to_string())
+                s.s.word(fstr.splitn(2, '.').last().unwrap().to_string())
             });
             err.span_suggestion(
                 lo.to(self.prev_span),
diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs
index e0eef1db0f0..e2749c7bd7c 100644
--- a/src/librustc_passes/dead.rs
+++ b/src/librustc_passes/dead.rs
@@ -553,7 +553,7 @@ impl DeadVisitor<'tcx> {
         node_type: &str,
         participle: &str,
     ) {
-        if !name.as_str().starts_with("_") {
+        if !name.as_str().starts_with('_') {
             self.tcx.struct_span_lint_hir(lint::builtin::DEAD_CODE, id, span, |lint| {
                 lint.build(&format!("{} is never {}: `{}`", node_type, participle, name)).emit()
             });
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index a81caea4e41..2a9e335e924 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -1103,7 +1103,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
     // Macro uses will remove items from this set, and the remaining
     // items will be reported as `unused_macros`.
     fn insert_unused_macro(&mut self, ident: Ident, node_id: NodeId, span: Span) {
-        if !ident.as_str().starts_with("_") {
+        if !ident.as_str().starts_with('_') {
             self.r.unused_macros.insert(node_id, span);
         }
     }
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index ebd3f8b832b..540877d22c2 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -2663,7 +2663,7 @@ impl<'a> Resolver<'a> {
                                 "{} as {}{}",
                                 &snippet[..pos],
                                 suggested_name,
-                                if snippet.ends_with(";") { ";" } else { "" }
+                                if snippet.ends_with(';') { ";" } else { "" }
                             ))
                         }
                     }
diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs
index 3f44339bf4c..edd0ba46f75 100644
--- a/src/librustc_target/abi/mod.rs
+++ b/src/librustc_target/abi/mod.rs
@@ -101,7 +101,7 @@ impl TargetDataLayout {
             match &*spec_parts {
                 ["e"] => dl.endian = Endian::Little,
                 ["E"] => dl.endian = Endian::Big,
-                [p] if p.starts_with("P") => {
+                [p] if p.starts_with('P') => {
                     dl.instruction_address_space = parse_address_space(&p[1..], "P")?
                 }
                 ["a", ref a @ ..] => dl.aggregate_align = align(a, "a")?,
@@ -111,7 +111,7 @@ impl TargetDataLayout {
                     dl.pointer_size = size(s, p)?;
                     dl.pointer_align = align(a, p)?;
                 }
-                [s, ref a @ ..] if s.starts_with("i") => {
+                [s, ref a @ ..] if s.starts_with('i') => {
                     let bits = match s[1..].parse::<u64>() {
                         Ok(bits) => bits,
                         Err(_) => {
@@ -135,7 +135,7 @@ impl TargetDataLayout {
                         dl.i128_align = a;
                     }
                 }
-                [s, ref a @ ..] if s.starts_with("v") => {
+                [s, ref a @ ..] if s.starts_with('v') => {
                     let v_size = size(&s[1..], "v")?;
                     let a = align(a, s)?;
                     if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 78c05a51e4f..22480019d68 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1777,7 +1777,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             {
                 let types: Vec<_> =
                     assoc_items.iter().map(|item| format!("{} = Type", item.ident)).collect();
-                let code = if snippet.ends_with(">") {
+                let code = if snippet.ends_with('>') {
                     // The user wrote `Trait<'a>` or similar and we don't have a type we can
                     // suggest, but at least we can clue them to the correct syntax
                     // `Trait<'a, Item = Type>` while accounting for the `<'a>` in the
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index c289176c303..3ebd6fde8b3 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -404,7 +404,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 {
                     if let hir::ExprKind::Lit(_) = expr.kind {
                         if let Ok(src) = sm.span_to_snippet(sp) {
-                            if src.starts_with("\"") {
+                            if src.starts_with('"') {
                                 return Some((
                                     sp,
                                     "consider adding a leading `b`",
@@ -701,7 +701,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 {
                     // Remove fractional part from literal, for example `42.0f32` into `42`
                     let src = src.trim_end_matches(&checked_ty.to_string());
-                    src.split(".").next().unwrap()
+                    src.split('.').next().unwrap()
                 } else {
                     src.trim_end_matches(&checked_ty.to_string())
                 },
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 4ab5d8f9ad3..409403f1973 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4996,7 +4996,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                             let sugg = if receiver.ends_with(".clone()")
                                 && method_call_list.contains(&method_call.as_str())
                             {
-                                let max_len = receiver.rfind(".").unwrap();
+                                let max_len = receiver.rfind('.').unwrap();
                                 format!("{}{}", &receiver[..max_len], method_call)
                             } else {
                                 if expr.precedence().order() < ExprPrecedence::MethodCall.order() {
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
index cb6e028ab86..2c5dcdde5e8 100644
--- a/src/librustc_typeck/check/op.rs
+++ b/src/librustc_typeck/check/op.rs
@@ -597,12 +597,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                         Ok(lstring) => {
                             err.span_suggestion(
                                 lhs_expr.span,
-                                if lstring.starts_with("&") {
+                                if lstring.starts_with('&') {
                                     remove_borrow_msg
                                 } else {
                                     msg
                                 },
-                                if lstring.starts_with("&") {
+                                if lstring.starts_with('&') {
                                     // let a = String::new();
                                     // let _ = &a + "bar";
                                     format!("{}", &lstring[1..])
@@ -630,7 +630,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     is_assign,
                 ) {
                     (Ok(l), Ok(r), false) => {
-                        let to_string = if l.starts_with("&") {
+                        let to_string = if l.starts_with('&') {
                             // let a = String::new(); let b = String::new();
                             // let _ = &a + b;
                             format!("{}", &l[1..])
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 61aa8e51cb0..ff70767235c 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -2206,7 +2206,7 @@ fn from_target_feature(
                         item.span(),
                         format!("`{}` is not valid for this target", feature),
                     );
-                    if feature.starts_with("+") {
+                    if feature.starts_with('+') {
                         let valid = whitelist.contains_key(&feature[1..]);
                         if valid {
                             err.help("consider removing the leading `+` in the feature name");
@@ -2337,7 +2337,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
             codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
         } else if attr.check_name(sym::export_name) {
             if let Some(s) = attr.value_str() {
-                if s.as_str().contains("\0") {
+                if s.as_str().contains('\0') {
                     // `#[export_name = ...]` will be converted to a null-terminated string,
                     // so it may not contain any null characters.
                     struct_span_err!(
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 56f7b07cfc8..ff6431640d3 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -707,7 +707,7 @@ impl LangString {
                 x if x.starts_with("edition") => {
                     data.edition = x[7..].parse::<Edition>().ok();
                 }
-                x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => {
+                x if allow_error_code_check && x.starts_with('E') && x.len() == 5 => {
                     if x[1..].parse::<u32>().is_ok() {
                         data.error_codes.push(x.to_owned());
                         seen_rust_tags = !seen_other_tags || seen_rust_tags;
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index bda220d8806..59677b28245 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -86,7 +86,7 @@ pub type NameDoc = (String, Option<String>);
 
 crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
     crate::html::format::display_fn(move |f| {
-        if !v.ends_with("/") && !v.is_empty() { write!(f, "{}/", v) } else { write!(f, "{}", v) }
+        if !v.ends_with('/') && !v.is_empty() { write!(f, "{}/", v) } else { write!(f, "{}", v) }
     })
 }
 
diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs
index 3acfb82fe78..e9ebccb7ec0 100644
--- a/src/librustdoc/html/render/cache.rs
+++ b/src/librustdoc/html/render/cache.rs
@@ -534,7 +534,7 @@ fn extern_location(
 
     if let Some(url) = extern_url {
         let mut url = url.to_string();
-        if !url.ends_with("/") {
+        if !url.ends_with('/') {
             url.push('/');
         }
         return Remote(url);
@@ -548,7 +548,7 @@ fn extern_location(
         .filter_map(|a| a.value_str())
         .map(|url| {
             let mut url = url.to_string();
-            if !url.ends_with("/") {
+            if !url.ends_with('/') {
                 url.push('/')
             }
             Remote(url)
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index a37efc22c93..a41fdd2ff17 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -19,7 +19,7 @@ fn extract_leading_metadata(s: &str) -> (Vec<&str>, &str) {
     let mut count = 0;
 
     for line in s.lines() {
-        if line.starts_with("# ") || line.starts_with("%") {
+        if line.starts_with("# ") || line.starts_with('%') {
             // trim the whitespace after the symbol
             metadata.push(line[1..].trim_start());
             count += line.len() + 1;
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 67b382c7a84..a50dd9575de 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -2396,9 +2396,9 @@ impl<B: BufRead> Iterator for Lines<B> {
         match self.buf.read_line(&mut buf) {
             Ok(0) => None,
             Ok(_n) => {
-                if buf.ends_with("\n") {
+                if buf.ends_with('\n') {
                     buf.pop();
-                    if buf.ends_with("\r") {
+                    if buf.ends_with('\r') {
                         buf.pop();
                     }
                 }