Auto merge of #53599 - matthiaskrgr:split_str__to__split_char, r=frewsxcv
use char pattern for single-character splits: a.split("x") -> a.split('x')
This commit is contained in:
commit
23ea1b8188
3 changed files with 3 additions and 3 deletions
|
@ -59,7 +59,7 @@ pub mod lossy;
|
||||||
///
|
///
|
||||||
/// fn from_str(s: &str) -> Result<Self, Self::Err> {
|
/// fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
/// let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
|
/// let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
|
||||||
/// .split(",")
|
/// .split(',')
|
||||||
/// .collect();
|
/// .collect();
|
||||||
///
|
///
|
||||||
/// let x_fromstr = coords[0].parse::<i32>()?;
|
/// let x_fromstr = coords[0].parse::<i32>()?;
|
||||||
|
|
|
@ -89,7 +89,7 @@ impl<'a, 'tcx> AssertModuleSource<'a, 'tcx> {
|
||||||
(&user_path[..], None)
|
(&user_path[..], None)
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut cgu_path_components = user_path.split("-").collect::<Vec<_>>();
|
let mut cgu_path_components = user_path.split('-').collect::<Vec<_>>();
|
||||||
|
|
||||||
// Remove the crate name
|
// Remove the crate name
|
||||||
assert_eq!(cgu_path_components.remove(0), crate_name);
|
assert_eq!(cgu_path_components.remove(0), crate_name);
|
||||||
|
|
|
@ -205,7 +205,7 @@ fn build_rule(v: &[u8], positions: &[usize]) -> String {
|
||||||
.replace("\t", " ")
|
.replace("\t", " ")
|
||||||
.replace("{", "")
|
.replace("{", "")
|
||||||
.replace("}", "")
|
.replace("}", "")
|
||||||
.split(" ")
|
.split(' ')
|
||||||
.filter(|s| s.len() > 0)
|
.filter(|s| s.len() > 0)
|
||||||
.collect::<Vec<&str>>()
|
.collect::<Vec<&str>>()
|
||||||
.join(" ")
|
.join(" ")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue