mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
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:
parent
12440d5e0d
commit
5935681c5c
@ -297,7 +297,7 @@ fn strip_invalid_spans_from_codeblock(
|
|||||||
} else if buffer.starts_with("<|")
|
} else if buffer.starts_with("<|")
|
||||||
|| buffer.starts_with("<|S")
|
|| buffer.starts_with("<|S")
|
||||||
|| buffer.starts_with("<|S|")
|
|| buffer.starts_with("<|S|")
|
||||||
|| buffer.ends_with("|")
|
|| buffer.ends_with('|')
|
||||||
|| buffer.ends_with("|E")
|
|| buffer.ends_with("|E")
|
||||||
|| buffer.ends_with("|E|")
|
|| buffer.ends_with("|E|")
|
||||||
{
|
{
|
||||||
@ -335,7 +335,7 @@ fn strip_invalid_spans_from_codeblock(
|
|||||||
.strip_suffix("|E|>")
|
.strip_suffix("|E|>")
|
||||||
.or_else(|| text.strip_suffix("E|>"))
|
.or_else(|| text.strip_suffix("E|>"))
|
||||||
.or_else(|| text.strip_prefix("|>"))
|
.or_else(|| text.strip_prefix("|>"))
|
||||||
.or_else(|| text.strip_prefix(">"))
|
.or_else(|| text.strip_prefix('>'))
|
||||||
.unwrap_or(&text)
|
.unwrap_or(&text)
|
||||||
.to_string();
|
.to_string();
|
||||||
};
|
};
|
||||||
|
@ -592,7 +592,7 @@ impl ChannelStore {
|
|||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> Task<Result<ChannelId>> {
|
) -> Task<Result<ChannelId>> {
|
||||||
let client = self.client.clone();
|
let client = self.client.clone();
|
||||||
let name = name.trim_start_matches("#").to_owned();
|
let name = name.trim_start_matches('#').to_owned();
|
||||||
cx.spawn(move |this, mut cx| async move {
|
cx.spawn(move |this, mut cx| async move {
|
||||||
let response = client
|
let response = client
|
||||||
.request(proto::CreateChannel {
|
.request(proto::CreateChannel {
|
||||||
|
@ -168,7 +168,7 @@ async fn new_test_user(db: &Arc<Database>, email: &str) -> UserId {
|
|||||||
email,
|
email,
|
||||||
false,
|
false,
|
||||||
NewUserParams {
|
NewUserParams {
|
||||||
github_login: email[0..email.find("@").unwrap()].to_string(),
|
github_login: email[0..email.find('@').unwrap()].to_string(),
|
||||||
github_user_id: GITHUB_USER_ID.fetch_add(1, SeqCst),
|
github_user_id: GITHUB_USER_ID.fetch_add(1, SeqCst),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -310,7 +310,7 @@ impl MessageEditor {
|
|||||||
for range in ranges {
|
for range in ranges {
|
||||||
text.clear();
|
text.clear();
|
||||||
text.extend(buffer.text_for_range(range.clone()));
|
text.extend(buffer.text_for_range(range.clone()));
|
||||||
if let Some(username) = text.strip_prefix("@") {
|
if let Some(username) = text.strip_prefix('@') {
|
||||||
if let Some(user_id) = this.channel_members.get(username) {
|
if let Some(user_id) = this.channel_members.get(username) {
|
||||||
let start = multi_buffer.anchor_after(range.start);
|
let start = multi_buffer.anchor_after(range.start);
|
||||||
let end = multi_buffer.anchor_after(range.end);
|
let end = multi_buffer.anchor_after(range.end);
|
||||||
|
@ -4845,7 +4845,7 @@ impl Editor {
|
|||||||
.text_for_range(start_point..end_point)
|
.text_for_range(start_point..end_point)
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
|
|
||||||
let mut lines = text.split("\n").collect_vec();
|
let mut lines = text.split('\n').collect_vec();
|
||||||
|
|
||||||
let lines_before = lines.len();
|
let lines_before = lines.len();
|
||||||
callback(&mut lines);
|
callback(&mut lines);
|
||||||
@ -4913,7 +4913,7 @@ impl Editor {
|
|||||||
self.manipulate_text(cx, |text| {
|
self.manipulate_text(cx, |text| {
|
||||||
// Hack to get around the fact that to_case crate doesn't support '\n' as a word boundary
|
// 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
|
// https://github.com/rutrum/convert-case/issues/16
|
||||||
text.split("\n")
|
text.split('\n')
|
||||||
.map(|line| line.to_case(Case::Title))
|
.map(|line| line.to_case(Case::Title))
|
||||||
.join("\n")
|
.join("\n")
|
||||||
})
|
})
|
||||||
@ -4935,7 +4935,7 @@ impl Editor {
|
|||||||
self.manipulate_text(cx, |text| {
|
self.manipulate_text(cx, |text| {
|
||||||
// Hack to get around the fact that to_case crate doesn't support '\n' as a word boundary
|
// 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
|
// https://github.com/rutrum/convert-case/issues/16
|
||||||
text.split("\n")
|
text.split('\n')
|
||||||
.map(|line| line.to_case(Case::UpperCamel))
|
.map(|line| line.to_case(Case::UpperCamel))
|
||||||
.join("\n")
|
.join("\n")
|
||||||
})
|
})
|
||||||
@ -9387,7 +9387,7 @@ impl Editor {
|
|||||||
let highlight = chunk
|
let highlight = chunk
|
||||||
.syntax_highlight_id
|
.syntax_highlight_id
|
||||||
.and_then(|id| id.name(&style.syntax));
|
.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() {
|
while let Some(text) = chunk_lines.next() {
|
||||||
let mut merged_with_last_token = false;
|
let mut merged_with_last_token = false;
|
||||||
if let Some(last_token) = line.back_mut() {
|
if let Some(last_token) = line.back_mut() {
|
||||||
|
@ -105,7 +105,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
|
|||||||
.trim_start_matches("https://github.com/")
|
.trim_start_matches("https://github.com/")
|
||||||
.trim_end_matches(".git");
|
.trim_end_matches(".git");
|
||||||
|
|
||||||
let (owner, repo) = repo_with_owner.split_once("/")?;
|
let (owner, repo) = repo_with_owner.split_once('/')?;
|
||||||
|
|
||||||
return Some(ParsedGitRemote {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Github,
|
provider: GitHostingProvider::Github,
|
||||||
@ -120,7 +120,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
|
|||||||
.trim_start_matches("https://gitlab.com/")
|
.trim_start_matches("https://gitlab.com/")
|
||||||
.trim_end_matches(".git");
|
.trim_end_matches(".git");
|
||||||
|
|
||||||
let (owner, repo) = repo_with_owner.split_once("/")?;
|
let (owner, repo) = repo_with_owner.split_once('/')?;
|
||||||
|
|
||||||
return Some(ParsedGitRemote {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Gitlab,
|
provider: GitHostingProvider::Gitlab,
|
||||||
@ -135,7 +135,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
|
|||||||
.trim_start_matches("https://gitee.com/")
|
.trim_start_matches("https://gitee.com/")
|
||||||
.trim_end_matches(".git");
|
.trim_end_matches(".git");
|
||||||
|
|
||||||
let (owner, repo) = repo_with_owner.split_once("/")?;
|
let (owner, repo) = repo_with_owner.split_once('/')?;
|
||||||
|
|
||||||
return Some(ParsedGitRemote {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Gitee,
|
provider: GitHostingProvider::Gitee,
|
||||||
@ -147,9 +147,9 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
|
|||||||
if url.contains("bitbucket.org") {
|
if url.contains("bitbucket.org") {
|
||||||
let (_, repo_with_owner) = url.trim_end_matches(".git").split_once("bitbucket.org")?;
|
let (_, repo_with_owner) = url.trim_end_matches(".git").split_once("bitbucket.org")?;
|
||||||
let (owner, repo) = repo_with_owner
|
let (owner, repo) = repo_with_owner
|
||||||
.trim_start_matches("/")
|
.trim_start_matches('/')
|
||||||
.trim_start_matches(":")
|
.trim_start_matches(':')
|
||||||
.split_once("/")?;
|
.split_once('/')?;
|
||||||
|
|
||||||
return Some(ParsedGitRemote {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Bitbucket,
|
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("git@git.sr.ht:~")
|
||||||
.trim_start_matches("https://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 {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Sourcehut,
|
provider: GitHostingProvider::Sourcehut,
|
||||||
@ -181,7 +181,7 @@ fn parse_git_remote_url(url: &str) -> Option<ParsedGitRemote> {
|
|||||||
.trim_start_matches("https://codeberg.org/")
|
.trim_start_matches("https://codeberg.org/")
|
||||||
.trim_end_matches(".git");
|
.trim_end_matches(".git");
|
||||||
|
|
||||||
let (owner, repo) = repo_with_owner.split_once("/")?;
|
let (owner, repo) = repo_with_owner.split_once('/')?;
|
||||||
|
|
||||||
return Some(ParsedGitRemote {
|
return Some(ParsedGitRemote {
|
||||||
provider: GitHostingProvider::Codeberg,
|
provider: GitHostingProvider::Codeberg,
|
||||||
|
@ -701,7 +701,7 @@ impl PickerDelegate for FileFinderDelegate {
|
|||||||
raw_query: String,
|
raw_query: String,
|
||||||
cx: &mut ViewContext<Picker<Self>>,
|
cx: &mut ViewContext<Picker<Self>>,
|
||||||
) -> Task<()> {
|
) -> Task<()> {
|
||||||
let raw_query = raw_query.replace(" ", "");
|
let raw_query = raw_query.replace(' ', "");
|
||||||
let raw_query = raw_query.trim();
|
let raw_query = raw_query.trim();
|
||||||
if raw_query.is_empty() {
|
if raw_query.is_empty() {
|
||||||
let project = self.project.read(cx);
|
let project = self.project.read(cx);
|
||||||
|
@ -331,7 +331,7 @@ impl TestAppContext {
|
|||||||
/// This will also run the background executor until it's parked.
|
/// This will also run the background executor until it's parked.
|
||||||
pub fn simulate_keystrokes(&mut self, window: AnyWindowHandle, keystrokes: &str) {
|
pub fn simulate_keystrokes(&mut self, window: AnyWindowHandle, keystrokes: &str) {
|
||||||
for keystroke in keystrokes
|
for keystroke in keystrokes
|
||||||
.split(" ")
|
.split(' ')
|
||||||
.map(Keystroke::parse)
|
.map(Keystroke::parse)
|
||||||
.map(Result::unwrap)
|
.map(Result::unwrap)
|
||||||
{
|
{
|
||||||
|
@ -1110,7 +1110,7 @@ fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppC
|
|||||||
b();
|
b();
|
||||||
|
|
|
|
||||||
"
|
"
|
||||||
.replace("|", "") // marker to preserve trailing whitespace
|
.replace('|', "") // marker to preserve trailing whitespace
|
||||||
.unindent(),
|
.unindent(),
|
||||||
)
|
)
|
||||||
.with_language(Arc::new(rust_lang()), cx);
|
.with_language(Arc::new(rust_lang()), cx);
|
||||||
@ -1787,7 +1787,7 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
|
|||||||
|
|
||||||
// In a JSX expression: use the default config.
|
// In a JSX expression: use the default config.
|
||||||
let expression_in_element_config = snapshot
|
let expression_in_element_config = snapshot
|
||||||
.language_scope_at(text.find("{").unwrap() + 1)
|
.language_scope_at(text.find('{').unwrap() + 1)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
expression_in_element_config
|
expression_in_element_config
|
||||||
@ -2321,7 +2321,7 @@ fn test_trailing_whitespace_ranges(mut rng: StdRng) {
|
|||||||
actual_ranges,
|
actual_ranges,
|
||||||
expected_ranges,
|
expected_ranges,
|
||||||
"wrong ranges for text lines:\n{:?}",
|
"wrong ranges for text lines:\n{:?}",
|
||||||
text.split("\n").collect::<Vec<_>>()
|
text.split('\n').collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ impl LspAdapter for OCamlLspAdapter {
|
|||||||
language: &Arc<language::Language>,
|
language: &Arc<language::Language>,
|
||||||
) -> Option<CodeLabel> {
|
) -> Option<CodeLabel> {
|
||||||
let name = &completion.label;
|
let name = &completion.label;
|
||||||
let detail = completion.detail.as_ref().map(|s| s.replace("\n", " "));
|
let detail = completion.detail.as_ref().map(|s| s.replace('\n', " "));
|
||||||
|
|
||||||
match completion.kind.zip(detail) {
|
match completion.kind.zip(detail) {
|
||||||
// Error of 'b : ('a, 'b) result
|
// Error of 'b : ('a, 'b) result
|
||||||
@ -124,7 +124,7 @@ impl LspAdapter for OCamlLspAdapter {
|
|||||||
// version : string
|
// version : string
|
||||||
// NOTE: (~|?) are omitted as we don't use them in the fuzzy filtering
|
// NOTE: (~|?) are omitted as we don't use them in the fuzzy filtering
|
||||||
Some((CompletionItemKind::FIELD, detail))
|
Some((CompletionItemKind::FIELD, detail))
|
||||||
if name.starts_with("~") || name.starts_with("?") =>
|
if name.starts_with('~') || name.starts_with('?') =>
|
||||||
{
|
{
|
||||||
let label = name.trim_start_matches(&['~', '?']);
|
let label = name.trim_start_matches(&['~', '?']);
|
||||||
let text = format!("{} : {}", label, detail);
|
let text = format!("{} : {}", label, detail);
|
||||||
|
@ -129,7 +129,7 @@ impl LspAdapter for TerraformLspAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_download_url(version: String) -> Result<String> {
|
fn build_download_url(version: String) -> Result<String> {
|
||||||
let v = version.strip_prefix("v").unwrap_or(&version);
|
let v = version.strip_prefix('v').unwrap_or(&version);
|
||||||
let os = match std::env::consts::OS {
|
let os = match std::env::consts::OS {
|
||||||
"linux" => "linux",
|
"linux" => "linux",
|
||||||
"macos" => "darwin",
|
"macos" => "darwin",
|
||||||
|
@ -377,7 +377,7 @@ impl LanguageServer {
|
|||||||
let headers = std::str::from_utf8(&buffer)?;
|
let headers = std::str::from_utf8(&buffer)?;
|
||||||
|
|
||||||
let message_len = headers
|
let message_len = headers
|
||||||
.split("\n")
|
.split('\n')
|
||||||
.find(|line| line.starts_with(CONTENT_LEN_HEADER))
|
.find(|line| line.starts_with(CONTENT_LEN_HEADER))
|
||||||
.and_then(|line| line.strip_prefix(CONTENT_LEN_HEADER))
|
.and_then(|line| line.strip_prefix(CONTENT_LEN_HEADER))
|
||||||
.ok_or_else(|| anyhow!("invalid LSP message header {headers:?}"))?
|
.ok_or_else(|| anyhow!("invalid LSP message header {headers:?}"))?
|
||||||
|
@ -607,7 +607,7 @@ impl ProjectPanel {
|
|||||||
worktree_id,
|
worktree_id,
|
||||||
entry_id: NEW_ENTRY_ID,
|
entry_id: NEW_ENTRY_ID,
|
||||||
});
|
});
|
||||||
let new_path = entry.path.join(&filename.trim_start_matches("/"));
|
let new_path = entry.path.join(&filename.trim_start_matches('/'));
|
||||||
if path_already_exists(new_path.as_path()) {
|
if path_already_exists(new_path.as_path()) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ async fn test_code_context_retrieval_json() {
|
|||||||
}
|
}
|
||||||
}"#
|
}"#
|
||||||
.unindent(),
|
.unindent(),
|
||||||
text.find("{").unwrap(),
|
text.find('{').unwrap(),
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ async fn test_code_context_retrieval_json() {
|
|||||||
"age": 42
|
"age": 42
|
||||||
}]"#
|
}]"#
|
||||||
.unindent(),
|
.unindent(),
|
||||||
text.find("[").unwrap(),
|
text.find('[').unwrap(),
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ pub fn command_interceptor(mut query: &str, cx: &AppContext) -> Option<CommandIn
|
|||||||
//
|
//
|
||||||
// For now, you can only do a replace on the % range, and you can
|
// For now, you can only do a replace on the % range, and you can
|
||||||
// only use a specific line number range to "go to line"
|
// only use a specific line number range to "go to line"
|
||||||
while query.starts_with(":") {
|
while query.starts_with(':') {
|
||||||
query = &query[1..];
|
query = &query[1..];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,16 +321,16 @@ pub fn command_interceptor(mut query: &str, cx: &AppContext) -> Option<CommandIn
|
|||||||
"0" => ("0", StartOfDocument.boxed_clone()),
|
"0" => ("0", StartOfDocument.boxed_clone()),
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
if query.starts_with("/") || query.starts_with("?") {
|
if query.starts_with('/') || query.starts_with('?') {
|
||||||
(
|
(
|
||||||
query,
|
query,
|
||||||
FindCommand {
|
FindCommand {
|
||||||
query: query[1..].to_string(),
|
query: query[1..].to_string(),
|
||||||
backwards: query.starts_with("?"),
|
backwards: query.starts_with('?'),
|
||||||
}
|
}
|
||||||
.boxed_clone(),
|
.boxed_clone(),
|
||||||
)
|
)
|
||||||
} else if query.starts_with("%") {
|
} else if query.starts_with('%') {
|
||||||
(
|
(
|
||||||
query,
|
query,
|
||||||
ReplaceCommand {
|
ReplaceCommand {
|
||||||
|
@ -135,8 +135,8 @@ fn paste(_: &mut Workspace, action: &Paste, cx: &mut ViewContext<Workspace>) {
|
|||||||
} else {
|
} else {
|
||||||
(clipboard_text.to_string(), first_selection_indent_column)
|
(clipboard_text.to_string(), first_selection_indent_column)
|
||||||
};
|
};
|
||||||
let line_mode = to_insert.ends_with("\n");
|
let line_mode = to_insert.ends_with('\n');
|
||||||
let is_multiline = to_insert.contains("\n");
|
let is_multiline = to_insert.contains('\n');
|
||||||
|
|
||||||
if line_mode && !before {
|
if line_mode && !before {
|
||||||
if selection.is_empty() {
|
if selection.is_empty() {
|
||||||
@ -480,7 +480,7 @@ mod test {
|
|||||||
the_
|
the_
|
||||||
ˇfox jumps over
|
ˇfox jumps over
|
||||||
_dog"}
|
_dog"}
|
||||||
.replace("_", " "), // Hack for trailing whitespace
|
.replace('_', " "), // Hack for trailing whitespace
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
cx.assert_shared_clipboard("lazy").await;
|
cx.assert_shared_clipboard("lazy").await;
|
||||||
|
@ -72,7 +72,7 @@ impl NeovimBackedTestContext {
|
|||||||
let test_name = thread
|
let test_name = thread
|
||||||
.name()
|
.name()
|
||||||
.expect("thread is not named")
|
.expect("thread is not named")
|
||||||
.split(":")
|
.split(':')
|
||||||
.last()
|
.last()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
@ -122,7 +122,7 @@ impl NeovimBackedTestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn set_shared_state(&mut self, marked_text: &str) {
|
pub async fn set_shared_state(&mut self, marked_text: &str) {
|
||||||
let mode = if marked_text.contains("»") {
|
let mode = if marked_text.contains('»') {
|
||||||
Mode::Visual
|
Mode::Visual
|
||||||
} else {
|
} else {
|
||||||
Mode::Normal
|
Mode::Normal
|
||||||
@ -188,7 +188,7 @@ impl NeovimBackedTestContext {
|
|||||||
|
|
||||||
pub async fn assert_shared_state(&mut self, marked_text: &str) {
|
pub async fn assert_shared_state(&mut self, marked_text: &str) {
|
||||||
self.is_dirty = false;
|
self.is_dirty = false;
|
||||||
let marked_text = marked_text.replace("•", " ");
|
let marked_text = marked_text.replace('•', " ");
|
||||||
let neovim = self.neovim_state().await;
|
let neovim = self.neovim_state().await;
|
||||||
let neovim_mode = self.neovim_mode().await;
|
let neovim_mode = self.neovim_mode().await;
|
||||||
let editor = self.editor_state();
|
let editor = self.editor_state();
|
||||||
|
@ -392,7 +392,7 @@ impl NeovimConnection {
|
|||||||
// the content of the selection via the "a register to get the shape correctly.
|
// the content of the selection via the "a register to get the shape correctly.
|
||||||
self.nvim.input("\"aygv").await.unwrap();
|
self.nvim.input("\"aygv").await.unwrap();
|
||||||
let content = self.nvim.command_output("echo getreg('a')").await.unwrap();
|
let content = self.nvim.command_output("echo getreg('a')").await.unwrap();
|
||||||
let lines = content.split("\n").collect::<Vec<_>>();
|
let lines = content.split('\n').collect::<Vec<_>>();
|
||||||
let top = cmp::min(selection_row, cursor_row);
|
let top = cmp::min(selection_row, cursor_row);
|
||||||
let left = cmp::min(selection_col, cursor_col);
|
let left = cmp::min(selection_col, cursor_col);
|
||||||
for row in top..=cmp::max(selection_row, cursor_row) {
|
for row in top..=cmp::max(selection_row, cursor_row) {
|
||||||
|
@ -2586,8 +2586,8 @@ mod tests {
|
|||||||
|
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
let items = labels.map(|mut label| {
|
let items = labels.map(|mut label| {
|
||||||
if label.ends_with("*") {
|
if label.ends_with('*') {
|
||||||
label = label.trim_end_matches("*");
|
label = label.trim_end_matches('*');
|
||||||
active_item_index = index;
|
active_item_index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,7 +1260,7 @@ impl Workspace {
|
|||||||
fn send_keystrokes(&mut self, action: &SendKeystrokes, cx: &mut ViewContext<Self>) {
|
fn send_keystrokes(&mut self, action: &SendKeystrokes, cx: &mut ViewContext<Self>) {
|
||||||
let mut keystrokes: Vec<Keystroke> = action
|
let mut keystrokes: Vec<Keystroke> = action
|
||||||
.0
|
.0
|
||||||
.split(" ")
|
.split(' ')
|
||||||
.flat_map(|k| Keystroke::parse(k).log_err())
|
.flat_map(|k| Keystroke::parse(k).log_err())
|
||||||
.collect();
|
.collect();
|
||||||
keystrokes.reverse();
|
keystrokes.reverse();
|
||||||
|
@ -95,10 +95,10 @@ impl OpenListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_zed_url_scheme(&self, request_path: &str) -> Option<OpenRequest> {
|
fn handle_zed_url_scheme(&self, request_path: &str) -> Option<OpenRequest> {
|
||||||
let mut parts = request_path.split("/");
|
let mut parts = request_path.split('/');
|
||||||
if parts.next() == Some("channel") {
|
if parts.next() == Some("channel") {
|
||||||
if let Some(slug) = parts.next() {
|
if let Some(slug) = parts.next() {
|
||||||
if let Some(id_str) = slug.split("-").last() {
|
if let Some(id_str) = slug.split('-').last() {
|
||||||
if let Ok(channel_id) = id_str.parse::<u64>() {
|
if let Ok(channel_id) = id_str.parse::<u64>() {
|
||||||
let Some(next) = parts.next() else {
|
let Some(next) = parts.next() else {
|
||||||
return Some(OpenRequest::JoinChannel { channel_id });
|
return Some(OpenRequest::JoinChannel { channel_id });
|
||||||
|
@ -124,7 +124,6 @@ fn run_clippy(args: ClippyArgs) -> Result<()> {
|
|||||||
"clippy::redundant_locals",
|
"clippy::redundant_locals",
|
||||||
"clippy::reversed_empty_ranges",
|
"clippy::reversed_empty_ranges",
|
||||||
"clippy::search_is_some",
|
"clippy::search_is_some",
|
||||||
"clippy::single_char_pattern",
|
|
||||||
"clippy::single_range_in_vec_init",
|
"clippy::single_range_in_vec_init",
|
||||||
"clippy::suspicious_to_owned",
|
"clippy::suspicious_to_owned",
|
||||||
"clippy::to_string_in_format_args",
|
"clippy::to_string_in_format_args",
|
||||||
|
Loading…
Reference in New Issue
Block a user