Enable clippy::single_char_pattern (#8727)

This PR enables the
[`clippy::single_char_pattern`](https://rust-lang.github.io/rust-clippy/master/index.html#/single_char_pattern)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2024-03-02 17:04:59 -05:00
committed by GitHub
parent 12440d5e0d
commit 5935681c5c
22 changed files with 45 additions and 46 deletions
+4 -4
View File
@@ -4845,7 +4845,7 @@ impl Editor {
.text_for_range(start_point..end_point)
.collect::<String>();
let mut lines = text.split("\n").collect_vec();
let mut lines = text.split('\n').collect_vec();
let lines_before = lines.len();
callback(&mut lines);
@@ -4913,7 +4913,7 @@ impl Editor {
self.manipulate_text(cx, |text| {
// Hack to get around the fact that to_case crate doesn't support '\n' as a word boundary
// https://github.com/rutrum/convert-case/issues/16
text.split("\n")
text.split('\n')
.map(|line| line.to_case(Case::Title))
.join("\n")
})
@@ -4935,7 +4935,7 @@ impl Editor {
self.manipulate_text(cx, |text| {
// Hack to get around the fact that to_case crate doesn't support '\n' as a word boundary
// https://github.com/rutrum/convert-case/issues/16
text.split("\n")
text.split('\n')
.map(|line| line.to_case(Case::UpperCamel))
.join("\n")
})
@@ -9387,7 +9387,7 @@ impl Editor {
let highlight = chunk
.syntax_highlight_id
.and_then(|id| id.name(&style.syntax));
let mut chunk_lines = chunk.text.split("\n").peekable();
let mut chunk_lines = chunk.text.split('\n').peekable();
while let Some(text) = chunk_lines.next() {
let mut merged_with_last_token = false;
if let Some(last_token) = line.back_mut() {
+8 -8
View File
@@ -105,7 +105,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
.trim_start_matches("https://github.com/")
.trim_end_matches(".git");
let (owner, repo) = repo_with_owner.split_once("/")?;
let (owner, repo) = repo_with_owner.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Github,
@@ -120,7 +120,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
.trim_start_matches("https://gitlab.com/")
.trim_end_matches(".git");
let (owner, repo) = repo_with_owner.split_once("/")?;
let (owner, repo) = repo_with_owner.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Gitlab,
@@ -135,7 +135,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
.trim_start_matches("https://gitee.com/")
.trim_end_matches(".git");
let (owner, repo) = repo_with_owner.split_once("/")?;
let (owner, repo) = repo_with_owner.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Gitee,
@@ -147,9 +147,9 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
if url.contains("bitbucket.org") {
let (_, repo_with_owner) = url.trim_end_matches(".git").split_once("bitbucket.org")?;
let (owner, repo) = repo_with_owner
.trim_start_matches("/")
.trim_start_matches(":")
.split_once("/")?;
.trim_start_matches('/')
.trim_start_matches(':')
.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Bitbucket,
@@ -166,7 +166,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
.trim_start_matches("git@git.sr.ht:~")
.trim_start_matches("https://git.sr.ht/~");
let (owner, repo) = repo_with_owner.split_once("/")?;
let (owner, repo) = repo_with_owner.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Sourcehut,
@@ -181,7 +181,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
.trim_start_matches("https://codeberg.org/")
.trim_end_matches(".git");
let (owner, repo) = repo_with_owner.split_once("/")?;
let (owner, repo) = repo_with_owner.split_once('/')?;
return Some(ParsedGitRemote {
provider: GitHostingProvider::Codeberg,