chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but hey, it's a start. Release Notes: - N/A
This commit is contained in:
parent
93249fc82b
commit
e6c1c51b37
361 changed files with 3530 additions and 3587 deletions
|
@ -432,7 +432,7 @@ impl ProjectDiagnosticsEditor {
|
|||
.unwrap();
|
||||
|
||||
prev_excerpt_id = excerpt_id;
|
||||
first_excerpt_id.get_or_insert_with(|| prev_excerpt_id);
|
||||
first_excerpt_id.get_or_insert(prev_excerpt_id);
|
||||
group_state.excerpts.push(excerpt_id);
|
||||
let header_position = (excerpt_id, language::Anchor::MIN);
|
||||
|
||||
|
@ -491,7 +491,7 @@ impl ProjectDiagnosticsEditor {
|
|||
blocks_to_remove.extend(group_state.blocks.iter().copied());
|
||||
} else if let Some((_, group_state)) = to_keep {
|
||||
prev_excerpt_id = *group_state.excerpts.last().unwrap();
|
||||
first_excerpt_id.get_or_insert_with(|| prev_excerpt_id);
|
||||
first_excerpt_id.get_or_insert(prev_excerpt_id);
|
||||
path_state.diagnostic_groups.push(group_state);
|
||||
}
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ impl Item for ProjectDiagnosticsEditor {
|
|||
}
|
||||
}
|
||||
|
||||
const DIAGNOSTIC_HEADER: &'static str = "diagnostic header";
|
||||
const DIAGNOSTIC_HEADER: &str = "diagnostic header";
|
||||
|
||||
fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
|
||||
let (message, code_ranges) = highlight_diagnostic_message(&diagnostic, None);
|
||||
|
|
|
@ -773,9 +773,7 @@ async fn test_random_diagnostics(cx: &mut TestAppContext, mut rng: StdRng) {
|
|||
(
|
||||
path.clone(),
|
||||
server_id,
|
||||
current_diagnostics
|
||||
.entry((path, server_id))
|
||||
.or_insert(vec![]),
|
||||
current_diagnostics.entry((path, server_id)).or_default(),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
@ -853,8 +851,8 @@ fn get_diagnostics_excerpts(
|
|||
result.push(ExcerptInfo {
|
||||
path: buffer.file().unwrap().path().to_path_buf(),
|
||||
range: ExcerptRange {
|
||||
context: range.context.to_point(&buffer),
|
||||
primary: range.primary.map(|range| range.to_point(&buffer)),
|
||||
context: range.context.to_point(buffer),
|
||||
primary: range.primary.map(|range| range.to_point(buffer)),
|
||||
},
|
||||
group_id: usize::MAX,
|
||||
primary: false,
|
||||
|
@ -962,9 +960,9 @@ fn random_diagnostic(
|
|||
}
|
||||
}
|
||||
|
||||
const FILE_HEADER: &'static str = "file header";
|
||||
const EXCERPT_HEADER: &'static str = "excerpt header";
|
||||
const EXCERPT_FOOTER: &'static str = "excerpt footer";
|
||||
const FILE_HEADER: &str = "file header";
|
||||
const EXCERPT_HEADER: &str = "excerpt header";
|
||||
const EXCERPT_FOOTER: &str = "excerpt footer";
|
||||
|
||||
fn editor_blocks(
|
||||
editor: &View<Editor>,
|
||||
|
|
|
@ -18,7 +18,7 @@ impl Render for ToolbarControls {
|
|||
let editor = editor.read(cx);
|
||||
include_warnings = editor.include_warnings;
|
||||
has_stale_excerpts = !editor.paths_to_update.is_empty();
|
||||
is_updating = editor.update_paths_tx.len() > 0
|
||||
is_updating = !editor.update_paths_tx.is_empty()
|
||||
|| editor
|
||||
.project
|
||||
.read(cx)
|
||||
|
@ -84,6 +84,12 @@ impl ToolbarItemView for ToolbarControls {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for ToolbarControls {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToolbarControls {
|
||||
pub fn new() -> Self {
|
||||
ToolbarControls { editor: None }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue