Skip to content

Commit 49c8ba9

Browse files
committed
Change single char str patterns to chars
1 parent 210d61f commit 49c8ba9

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/librustc/dep_graph/debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl DepNodeFilter {
4040
/// Tests whether `node` meets the filter, returning true if so.
4141
pub fn test(&self, node: &DepNode) -> bool {
4242
let debug_str = format!("{:?}", node);
43-
self.text.split("&")
43+
self.text.split('&')
4444
.map(|s| s.trim())
4545
.all(|f| debug_str.contains(f))
4646
}

src/librustc/middle/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
165165
&attr::Stable {since: stab_since}) = (&stab.rustc_depr, &stab.level) {
166166
// Explicit version of iter::order::lt to handle parse errors properly
167167
for (dep_v, stab_v) in
168-
dep_since.as_str().split(".").zip(stab_since.as_str().split(".")) {
168+
dep_since.as_str().split('.').zip(stab_since.as_str().split('.')) {
169169
if let (Ok(dep_v), Ok(stab_v)) = (dep_v.parse::<u64>(), stab_v.parse()) {
170170
match dep_v.cmp(&stab_v) {
171171
Ordering::Less => {

src/librustc_mir/util/pretty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>(
117117
// see notes on #41697 below
118118
tcx.item_path_str(source.def_id)
119119
});
120-
filters.split("|").any(|or_filter| {
121-
or_filter.split("&").all(|and_filter| {
120+
filters.split('|').any(|or_filter| {
121+
or_filter.split('&').all(|and_filter| {
122122
and_filter == "all" || pass_name.contains(and_filter) || node_path.contains(and_filter)
123123
})
124124
})
@@ -388,7 +388,7 @@ struct ExtraComments<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
388388

389389
impl<'cx, 'gcx, 'tcx> ExtraComments<'cx, 'gcx, 'tcx> {
390390
fn push(&mut self, lines: &str) {
391-
for line in lines.split("\n") {
391+
for line in lines.split('\n') {
392392
self.comments.push(line.to_string());
393393
}
394394
}

src/librustc_target/abi/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ impl TargetDataLayout {
9292

9393
let mut dl = TargetDataLayout::default();
9494
let mut i128_align_src = 64;
95-
for spec in target.data_layout.split("-") {
96-
match &spec.split(":").collect::<Vec<_>>()[..] {
95+
for spec in target.data_layout.split('-') {
96+
match &spec.split(':').collect::<Vec<_>>()[..] {
9797
&["e"] => dl.endian = Endian::Little,
9898
&["E"] => dl.endian = Endian::Big,
9999
&["a", ref a..] => dl.aggregate_align = align(a, "a")?,

src/libstd/sys/redox/net/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ impl Iterator for LookupHost {
4141
pub fn lookup_host(host: &str) -> Result<LookupHost> {
4242
let mut ip_string = String::new();
4343
File::open("/etc/net/ip")?.read_to_string(&mut ip_string)?;
44-
let ip: Vec<u8> = ip_string.trim().split(".").map(|part| part.parse::<u8>()
44+
let ip: Vec<u8> = ip_string.trim().split('.').map(|part| part.parse::<u8>()
4545
.unwrap_or(0)).collect();
4646

4747
let mut dns_string = String::new();
4848
File::open("/etc/net/dns")?.read_to_string(&mut dns_string)?;
49-
let dns: Vec<u8> = dns_string.trim().split(".").map(|part| part.parse::<u8>()
49+
let dns: Vec<u8> = dns_string.trim().split('.').map(|part| part.parse::<u8>()
5050
.unwrap_or(0)).collect();
5151

5252
if ip.len() == 4 && dns.len() == 4 {

src/libstd/sys/unix/os.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ fn glibc_version_cstr() -> Option<&'static CStr> {
564564
// ignoring any extra dot-separated parts. Otherwise return None.
565565
#[cfg(target_env = "gnu")]
566566
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
567-
let mut parsed_ints = version.split(".").map(str::parse::<usize>).fuse();
567+
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
568568
match (parsed_ints.next(), parsed_ints.next()) {
569569
(Some(Ok(major)), Some(Ok(minor))) => Some((major, minor)),
570570
_ => None

src/tools/tidy/src/deps.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a> Crate<'a> {
165165
impl<'a> CrateVersion<'a> {
166166
/// Returns the struct and whether or not the dep is in-tree
167167
pub fn from_str(s: &'a str) -> (Self, bool) {
168-
let mut parts = s.split(" ");
168+
let mut parts = s.split(' ');
169169
let name = parts.next().unwrap();
170170
let version = parts.next().unwrap();
171171
let path = parts.next().unwrap();

src/tools/tidy/src/features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
257257
None
258258
} else {
259259
next_feature_is_rustc_internal = false;
260-
let s = issue_str.split("(").nth(1).unwrap().split(")").nth(0).unwrap();
260+
let s = issue_str.split('(').nth(1).unwrap().split(')').nth(0).unwrap();
261261
Some(s.parse().unwrap())
262262
};
263263
Some((name.to_owned(),

src/tools/tidy/src/style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn check(path: &Path, bad: &mut bool) {
131131
let skip_length = contents.contains("ignore-tidy-linelength");
132132
let skip_end_whitespace = contents.contains("ignore-tidy-end-whitespace");
133133
let mut trailing_new_lines = 0;
134-
for (i, line) in contents.split("\n").enumerate() {
134+
for (i, line) in contents.split('\n').enumerate() {
135135
let mut err = |msg: &str| {
136136
tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg);
137137
};

0 commit comments

Comments
 (0)