Auto-fix clippy::collapsible_if violations (#36428)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 15:27:24 +02:00 committed by GitHub
parent 9e8ec72bd5
commit 8f567383e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
281 changed files with 6628 additions and 7089 deletions

View file

@ -399,10 +399,10 @@ async fn read_kernels_dir(path: PathBuf, fs: &dyn Fs) -> Result<Vec<LocalKernelS
while let Some(path) = kernelspec_dirs.next().await {
match path {
Ok(path) => {
if fs.is_dir(path.as_path()).await {
if let Ok(kernelspec) = read_kernelspec_at(path, fs).await {
valid_kernelspecs.push(kernelspec);
}
if fs.is_dir(path.as_path()).await
&& let Ok(kernelspec) = read_kernelspec_at(path, fs).await
{
valid_kernelspecs.push(kernelspec);
}
}
Err(err) => log::warn!("Error reading kernelspec directory: {err:?}"),
@ -429,14 +429,14 @@ pub async fn local_kernel_specifications(fs: Arc<dyn Fs>) -> Result<Vec<LocalKer
.output()
.await;
if let Ok(command) = command {
if command.status.success() {
let python_prefix = String::from_utf8(command.stdout);
if let Ok(python_prefix) = python_prefix {
let python_prefix = PathBuf::from(python_prefix.trim());
let python_data_dir = python_prefix.join("share").join("jupyter");
data_dirs.push(python_data_dir);
}
if let Ok(command) = command
&& command.status.success()
{
let python_prefix = String::from_utf8(command.stdout);
if let Ok(python_prefix) = python_prefix {
let python_prefix = PathBuf::from(python_prefix.trim());
let python_data_dir = python_prefix.join("share").join("jupyter");
data_dirs.push(python_data_dir);
}
}

View file

@ -412,10 +412,10 @@ impl ExecutionView {
};
// Check for a clear output marker as the previous output, so we can clear it out
if let Some(output) = self.outputs.last() {
if let Output::ClearOutputWaitMarker = output {
self.outputs.clear();
}
if let Some(output) = self.outputs.last()
&& let Output::ClearOutputWaitMarker = output
{
self.outputs.clear();
}
self.outputs.push(output);
@ -433,11 +433,11 @@ impl ExecutionView {
let mut any = false;
self.outputs.iter_mut().for_each(|output| {
if let Some(other_display_id) = output.display_id().as_ref() {
if other_display_id == display_id {
*output = Output::new(data, Some(display_id.to_owned()), window, cx);
any = true;
}
if let Some(other_display_id) = output.display_id().as_ref()
&& other_display_id == display_id
{
*output = Output::new(data, Some(display_id.to_owned()), window, cx);
any = true;
}
});
@ -452,19 +452,18 @@ impl ExecutionView {
window: &mut Window,
cx: &mut Context<Self>,
) -> Option<Output> {
if let Some(last_output) = self.outputs.last_mut() {
if let Output::Stream {
if let Some(last_output) = self.outputs.last_mut()
&& let Output::Stream {
content: last_stream,
} = last_output
{
// Don't need to add a new output, we already have a terminal output
// and can just update the most recent terminal output
last_stream.update(cx, |last_stream, cx| {
last_stream.append_text(text, cx);
cx.notify();
});
return None;
}
{
// Don't need to add a new output, we already have a terminal output
// and can just update the most recent terminal output
last_stream.update(cx, |last_stream, cx| {
last_stream.append_text(text, cx);
cx.notify();
});
return None;
}
Some(Output::Stream {

View file

@ -417,10 +417,10 @@ fn runnable_ranges(
range: Range<Point>,
cx: &mut App,
) -> (Vec<Range<Point>>, Option<Point>) {
if let Some(language) = buffer.language() {
if language.name() == "Markdown".into() {
return (markdown_code_blocks(buffer, range.clone(), cx), None);
}
if let Some(language) = buffer.language()
&& language.name() == "Markdown".into()
{
return (markdown_code_blocks(buffer, range.clone(), cx), None);
}
let (jupytext_snippets, next_cursor) = jupytext_cells(buffer, range.clone());

View file

@ -102,21 +102,16 @@ pub fn init(cx: &mut App) {
let editor_handle = cx.entity().downgrade();
if let Some(language) = language {
if language.name() == "Python".into() {
if let (Some(project_path), Some(project)) = (project_path, project) {
let store = ReplStore::global(cx);
store.update(cx, |store, cx| {
store
.refresh_python_kernelspecs(
project_path.worktree_id,
&project,
cx,
)
.detach_and_log_err(cx);
});
}
}
if let Some(language) = language
&& language.name() == "Python".into()
&& let (Some(project_path), Some(project)) = (project_path, project)
{
let store = ReplStore::global(cx);
store.update(cx, |store, cx| {
store
.refresh_python_kernelspecs(project_path.worktree_id, &project, cx)
.detach_and_log_err(cx);
});
}
editor

View file

@ -171,10 +171,10 @@ impl ReplStore {
.map(KernelSpecification::Jupyter)
.collect::<Vec<_>>();
if let Some(remote_task) = remote_kernel_specifications {
if let Ok(remote_specs) = remote_task.await {
all_specs.extend(remote_specs);
}
if let Some(remote_task) = remote_kernel_specifications
&& let Ok(remote_specs) = remote_task.await
{
all_specs.extend(remote_specs);
}
anyhow::Ok(all_specs)