mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
fix clippy::single_char_pattern
This commit is contained in:
parent
7912e33ed6
commit
1f70886b15
10 changed files with 22 additions and 22 deletions
|
@ -1238,7 +1238,7 @@ fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json:
|
|||
let map = fields
|
||||
.iter()
|
||||
.map(|(field, ty, doc, default)| {
|
||||
let name = field.replace("_", ".");
|
||||
let name = field.replace('_', ".");
|
||||
let name = format!("rust-analyzer.{}", name);
|
||||
let props = field_props(field, ty, doc, default);
|
||||
(name, props)
|
||||
|
@ -1385,7 +1385,7 @@ fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
|
|||
fields
|
||||
.iter()
|
||||
.map(|(field, _ty, doc, default)| {
|
||||
let name = format!("rust-analyzer.{}", field.replace("_", "."));
|
||||
let name = format!("rust-analyzer.{}", field.replace('_', "."));
|
||||
let doc = doc_comment_to_string(*doc);
|
||||
if default.contains('\n') {
|
||||
format!(
|
||||
|
@ -1428,7 +1428,7 @@ mod tests {
|
|||
.trim_start_matches('{')
|
||||
.trim_end_matches('}')
|
||||
.replace(" ", " ")
|
||||
.replace("\n", "\n ")
|
||||
.replace('\n', "\n ")
|
||||
.trim_start_matches('\n')
|
||||
.trim_end()
|
||||
.to_string();
|
||||
|
|
|
@ -972,7 +972,7 @@ fn main() {}
|
|||
"documentChanges": [
|
||||
{
|
||||
"textDocument": {
|
||||
"uri": format!("file://{}", tmp_dir_path.join("src").join("lib.rs").to_str().unwrap().to_string().replace("C:\\", "/c:/").replace("\\", "/")),
|
||||
"uri": format!("file://{}", tmp_dir_path.join("src").join("lib.rs").to_str().unwrap().to_string().replace("C:\\", "/c:/").replace('\\', "/")),
|
||||
"version": null
|
||||
},
|
||||
"edits": [
|
||||
|
@ -1029,7 +1029,7 @@ fn main() {}
|
|||
"documentChanges": [
|
||||
{
|
||||
"textDocument": {
|
||||
"uri": format!("file://{}", tmp_dir_path.join("src").join("lib.rs").to_str().unwrap().to_string().replace("C:\\", "/c:/").replace("\\", "/")),
|
||||
"uri": format!("file://{}", tmp_dir_path.join("src").join("lib.rs").to_str().unwrap().to_string().replace("C:\\", "/c:/").replace('\\', "/")),
|
||||
"version": null
|
||||
},
|
||||
"edits": [
|
||||
|
|
|
@ -374,8 +374,8 @@ fn lines_match(expected: &str, actual: &str) -> bool {
|
|||
// Let's not deal with / vs \ (windows...)
|
||||
// First replace backslash-escaped backslashes with forward slashes
|
||||
// which can occur in, for example, JSON output
|
||||
let expected = expected.replace(r"\\", "/").replace(r"\", "/");
|
||||
let mut actual: &str = &actual.replace(r"\\", "/").replace(r"\", "/");
|
||||
let expected = expected.replace(r"\\", "/").replace('\\', "/");
|
||||
let mut actual: &str = &actual.replace(r"\\", "/").replace('\\', "/");
|
||||
for (i, part) in expected.split("[..]").enumerate() {
|
||||
match actual.find(part) {
|
||||
Some(j) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue