Miscellaneous improvements to prepare for Rust 1.100 (#66901)

## Summary

Fixes rustc and clippy warnings for a potential upcoming Rust 1.100
version bump. All changes are backwards compatible and Rust is **not**
bumped in this PR.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
- [GPUI] N/A

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
This commit is contained in:
tidely
2026-11-13 11:45:35 +00:00
committed by GitHub
parent 5a40bc8bd7
commit 4fd48c02ac
81 changed files with 139 additions and 191 deletions
Generated
-1
View File
@@ -10161,7 +10161,6 @@ dependencies = [
"postage",
"rodio",
"serde",
"serde_json",
"serde_urlencoded",
"settings",
"simplelog",
-1
View File
@@ -829,7 +829,6 @@ objc2-user-notifications = { version = "0.3", default-features = false, features
] }
octocrab = { version = "0.49", default-features = false }
oo7 = { git = "https://github.com/zed-industries/oo7", rev = "731c1215edb6905876c6137ab300428c7b8d7c13", version = "0.6", default-features = false }
open = "5.0.0"
ordered-float = "5"
palette = { version = "0.7.5", default-features = false, features = ["std"] }
parking_lot = "0.12.1"
+2 -2
View File
@@ -14275,7 +14275,7 @@ mod tests {
),
(
json!({"messageId": "patch", "content": replacement}),
replacement.clone(),
replacement,
json!({}),
),
(
@@ -14290,7 +14290,7 @@ mod tests {
),
(
json!({"messageId": "patch", "content": original, "_meta": {"restored": true}}),
original.clone(),
original,
json!({"restored": true}),
),
(
+1 -1
View File
@@ -473,7 +473,7 @@ impl LanguageModels {
}
if !provider_models.is_empty() {
language_model_list.insert(
acp_thread::AgentModelGroupName(provider.name().0.clone()),
acp_thread::AgentModelGroupName(provider.name().0),
provider_models,
);
}
+3 -3
View File
@@ -1623,7 +1623,7 @@ impl Thread {
compaction_id.clone(),
acp_thread::ContextCompactionStatus::Completed,
);
stream.send_context_compaction_update(compaction_id.clone(), summary);
stream.send_context_compaction_update(compaction_id, summary);
}
CompactionInfo::ProviderNative { .. } => {
stream.send_context_compaction(
@@ -3242,7 +3242,7 @@ impl Thread {
if let Some(fallback) = maybe_fallback {
log::info!("Refusal fallback: retrying with {}", fallback.id().0);
let fallback_name = fallback.name().0.clone();
let fallback_name = fallback.name().0;
this.update(cx, |this, cx| {
this.pending_message = None;
this.set_model(fallback.clone(), cx);
@@ -4484,7 +4484,7 @@ impl Thread {
let available = MAX_TOOL_NAME_LENGTH.saturating_sub(tool_name.len());
if available >= 2 {
let mut disambiguated =
provider_compatible_tool_name(&server_id.0.to_snake_case()).to_string();
provider_compatible_tool_name(&server_id.0.to_snake_case());
disambiguated.truncate(available - 1);
disambiguated.push('_');
disambiguated.push_str(&tool_name);
+1 -1
View File
@@ -407,7 +407,7 @@ fn reject_edits_in_ranges(
let buffer = multibuffer.read(cx).buffer(hunk.buffer_id);
if let Some(buffer) = buffer {
ranges_by_buffer
.entry(buffer.clone())
.entry(buffer)
.or_insert_with(Vec::new)
.push(hunk.buffer_range.clone());
}
@@ -6645,7 +6645,7 @@ impl ThreadView {
.toggleable(IconPosition::End, is_selected);
menu.push_item(entry.handler({
let effort = effort_level.value.clone();
let effort = effort_level.value;
let weak_self = weak_self.clone();
move |_window, cx| {
let effort = effort.clone();
+1 -1
View File
@@ -439,7 +439,7 @@ impl EntryViewState {
let element = create_terminal(
self.workspace.clone(),
self.project.clone(),
terminal.clone(),
terminal,
window,
cx,
)
+1 -1
View File
@@ -112,7 +112,7 @@ impl ModeSelector {
};
menu.push_item(entry.handler({
let mode_id = mode.value.clone();
let mode_id = mode.value;
let weak_self = weak_self.clone();
move |_window, cx| {
weak_self
+1 -1
View File
@@ -993,7 +993,7 @@ impl BufferDiffSnapshot {
log::debug!("unstaging hunk {:?}", buffer_offset_range);
Arc::from(
head_text
.chunks_in_range(diff_base_byte_range.clone())
.chunks_in_range(diff_base_byte_range)
.collect::<String>(),
)
};
+3
View File
@@ -5,6 +5,9 @@ edition.workspace = true
publish = false
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "src/codestral.rs"
test = false
+1 -1
View File
@@ -740,7 +740,7 @@ impl Database {
while let Some(db_status) = db_statuses.next().await {
let db_status: project_repository_statuses::Model = db_status?;
if db_status.is_deleted {
removed_statuses.push(db_status.repo_path.clone());
removed_statuses.push(db_status.repo_path);
} else {
updated_statuses.push(db_status_to_proto(db_status)?);
}
+4 -4
View File
@@ -2097,7 +2097,7 @@ async fn join_project(
removed_repositories: Default::default(),
};
for update in proto::split_worktree_update(message) {
session.peer.send(session.connection_id, update.clone())?;
session.peer.send(session.connection_id, update)?;
}
// Stream this worktree's diagnostics.
@@ -3030,7 +3030,7 @@ async fn create_channel(
channels: vec![channel.to_proto()],
..Default::default()
};
session.peer.send(connection_id, update.clone())?;
session.peer.send(connection_id, update)?;
}
Ok(())
@@ -3306,7 +3306,7 @@ async fn move_channel(
..Default::default()
};
session.peer.send(connection_id, update.clone())?;
session.peer.send(connection_id, update)?;
}
response.send(Ack {})?;
@@ -3350,7 +3350,7 @@ async fn reorder_channel(
..Default::default()
};
session.peer.send(connection_id, update.clone())?;
session.peer.send(connection_id, update)?;
}
}
+1 -5
View File
@@ -32,11 +32,7 @@ impl ZedVersion {
pub fn can_collaborate(&self) -> bool {
// v0.204.1 was the first version after the auto-update bug.
// We reject any clients older than that to hope we can persuade them to upgrade.
if self.0 < Version::new(0, 204, 1) {
return false;
}
true
self.0 >= Version::new(0, 204, 1)
}
}
@@ -1149,7 +1149,7 @@ impl RandomizedTest for ProjectCollaborationTest {
let range =
if start > end { end..start } else { start..end };
highlights.push(lsp::DocumentHighlight {
range: range_to_lsp(range.clone()).unwrap(),
range: range_to_lsp(range).unwrap(),
kind: Some(lsp::DocumentHighlightKind::READ),
});
}
+2 -2
View File
@@ -103,7 +103,7 @@ impl DebugPanel {
{
sessions_with_children.next();
SessionListEntry {
leaf: single_child.clone(),
leaf: single_child,
ancestors: vec![root.clone()],
}
} else {
@@ -197,7 +197,7 @@ impl DebugPanel {
},
{
let weak = weak.clone();
let leaf = session_entry.leaf.clone();
let leaf = session_entry.leaf;
move |window, cx| {
weak.update(cx, |panel, cx| {
panel.activate_session(leaf.clone(), window, cx);
+1 -2
View File
@@ -5,7 +5,6 @@ use std::{
borrow::Cow,
path::{Path, PathBuf},
sync::Arc,
usize,
};
use tasks_ui::{TaskOverrides, TasksModal};
@@ -515,7 +514,7 @@ impl NewProcessModal {
};
for adapter in available_adapters.into_iter() {
menu = menu.entry(adapter.0.clone(), None, setter_for_name(adapter.clone()));
menu = menu.entry(adapter.0.clone(), None, setter_for_name(adapter));
}
menu
@@ -311,7 +311,7 @@ impl StackFrameList {
_ => {
let collapsed_entries = std::mem::take(&mut collapsed_entries);
if !collapsed_entries.is_empty() {
entries.push(StackFrameEntry::Collapsed(collapsed_entries.clone()));
entries.push(StackFrameEntry::Collapsed(collapsed_entries));
}
first_stack_frame.get_or_insert(entries.len());
@@ -884,7 +884,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true
];
for entrypoint in self.features.iter().filter_map(|f| f.entrypoint()) {
entrypoint_script_lines.push(entrypoint.clone());
entrypoint_script_lines.push(entrypoint);
}
entrypoint_script_lines.append(&mut vec![
"exec \"$@\"".to_string(),
@@ -1505,7 +1505,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true
if let Some(service) = service_declarations.get_mut(network_service_name) {
service.ports.push(DockerComposeServicePort {
target: port.clone(),
published: port.clone(),
published: port,
..Default::default()
});
} else {
@@ -1514,7 +1514,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true
DockerComposeService {
ports: vec![DockerComposeServicePort {
target: port.clone(),
published: port.clone(),
published: port,
..Default::default()
}],
..Default::default()
@@ -1524,7 +1524,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true
} else {
main_service.ports.push(DockerComposeServicePort {
target: port.clone(),
published: port.clone(),
published: port,
..Default::default()
});
}
+1 -1
View File
@@ -695,7 +695,7 @@ impl ProjectDiagnosticsEditor {
for (block_id, block) in
block_ids.iter().zip(cloned_blocks.into_iter().flatten())
{
let markdown = block.markdown.clone();
let markdown = block.markdown;
editor::test::set_block_content_for_tests(
&this.editor,
*block_id,
@@ -36,7 +36,7 @@ pub fn assemble_excerpt_ranges(
});
add_outline_item(
item_range.clone(),
item_range,
body_range.clone(),
*input_order,
buffer,
@@ -653,7 +653,7 @@ fn identifiers_for_position(
if let Some(body_range) = item.body_range(&buffer) {
ranges.push(item.range.start..body_range.start.to_offset(&buffer));
} else {
ranges.push(item.range.clone());
ranges.push(item.range);
}
}
@@ -561,11 +561,7 @@ pub fn is_editable_region_correct(actual_patch: &str) -> bool {
}
}
if deletions_at_start >= 3 {
return false;
}
true
deletions_at_start < 3
}
#[derive(Debug, Default, Clone, Serialize)]
+1 -5
View File
@@ -437,16 +437,12 @@ impl DisplayMap {
}]);
self.block_map.deferred_edits.set(edits);
self.block_map.retain_blocks_raw(&mut |block| {
if companion
!companion
.read(cx)
.lhs_custom_block_to_balancing_block
.borrow()
.values()
.any(|id| *id == block.id)
{
return false;
}
true
});
return;
};
+3 -4
View File
@@ -17,7 +17,6 @@ use std::{
fmt, iter,
ops::{Add, AddAssign, Deref, DerefMut, Range, Sub, SubAssign},
sync::Arc,
usize,
};
use sum_tree::{Bias, Cursor, Dimensions, FilterCursor, SumTree, Summary, TreeMap};
use ui::IntoElement as _;
@@ -274,7 +273,7 @@ impl FoldMapWriter<'_> {
for range in ranges.into_iter() {
let range = range.start.to_offset(buffer)..range.end.to_offset(buffer);
let mut folds_cursor =
intersecting_folds(&snapshot, &self.0.snapshot.folds, range.clone(), inclusive);
intersecting_folds(&snapshot, &self.0.snapshot.folds, range, inclusive);
while let Some(fold) = folds_cursor.item() {
let offset_range =
fold.range.start.to_offset(buffer)..fold.range.end.to_offset(buffer);
@@ -335,7 +334,7 @@ impl FoldMapWriter<'_> {
..inlay_snapshot.to_inlay_offset(buffer_end);
edits.push(InlayEdit {
old: inlay_range.clone(),
new: inlay_range.clone(),
new: inlay_range,
});
self.0.snapshot.fold_metadata_by_id.insert(
@@ -2125,7 +2124,7 @@ mod tests {
let (snapshot, edits) = map.read(inlay_snapshot.clone(), inlay_edits);
snapshot_edits.push((snapshot.clone(), edits));
let mut expected_text: String = inlay_snapshot.text().to_string();
let mut expected_text: String = inlay_snapshot.text();
for fold_range in map.merged_folds().into_iter().rev() {
let fold_inlay_start = inlay_snapshot.to_inlay_offset(fold_range.start);
let fold_inlay_end = inlay_snapshot.to_inlay_offset(fold_range.end);
+1 -4
View File
@@ -4898,10 +4898,7 @@ impl Editor {
// Fill in the environmental variables from the tree-sitter captures
let mut captured_task_variables = TaskVariables::default();
for (capture_name, value) in tasks.extra_variables.clone() {
captured_task_variables.insert(
task::VariableName::Custom(capture_name.into()),
value.clone(),
);
captured_task_variables.insert(task::VariableName::Custom(capture_name.into()), value);
}
project.update(cx, |project, cx| {
project.task_store().update(cx, |task_store, cx| {
+3
View File
@@ -5,6 +5,9 @@ edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "etw_tracing.rs"
test = false
+1 -3
View File
@@ -153,9 +153,7 @@ fn save_etw_recording(output_path: PathBuf, cx: &mut App) {
return;
}
let command = Command::Save {
output_path: output_path.clone(),
};
let command = Command::Save { output_path };
match send_json(&mut session.writer, &command) {
Ok(()) => {
session.state = EtwSessionState::Stopping;
@@ -38,11 +38,7 @@ impl DownloadFileCapability {
}
}
if self.path.len() < desired_path.len() {
return false;
}
true
self.path.len() >= desired_path.len()
}
}
@@ -35,11 +35,7 @@ impl ProcessExecCapability {
}
}
if self.args.len() < desired_args.len() {
return false;
}
true
self.args.len() >= desired_args.len()
}
}
+2 -2
View File
@@ -1650,7 +1650,7 @@ impl ExtensionStore {
this.update(cx, |_, cx| {
SettingsStore::update_global(cx, |store, _| {
for (language_name, rules) in semantic_token_rules_to_add {
store.set_language_semantic_token_rules(language_name.0.clone(), rules);
store.set_language_semantic_token_rules(language_name.0, rules);
}
})
})
@@ -1702,7 +1702,7 @@ impl ExtensionStore {
this.proxy.register_language_server(
extension.clone(),
language_server_id.clone(),
language.clone(),
language,
);
}
}
+1 -1
View File
@@ -1870,7 +1870,7 @@ mod tests {
.expect("watch again")
.expect("registered again");
assert_eq!(backend.lock().watch_calls, [path.clone(), path.clone()]);
assert_eq!(backend.lock().watched_paths, HashSet::from([path.clone()]));
assert_eq!(backend.lock().watched_paths, HashSet::from([path]));
// The backend already dropped this watch, as inotify does when a
// watched directory is deleted.
+1 -1
View File
@@ -216,7 +216,7 @@ fn conflicts_updated(
let Some(range) = snapshot.buffer_anchor_range_to_anchor_range(conflict_range) else {
continue;
};
removed_highlighted_ranges.push(range.clone());
removed_highlighted_ranges.push(range);
removed_block_ids.insert(block_id);
}
+1 -1
View File
@@ -5539,7 +5539,7 @@ impl GitPanel {
.clone()
.or_else(|| participant.user.name.clone())
.unwrap_or_else(|| participant.user.username.clone().to_string());
new_co_authors.push((name.clone(), email.clone()))
new_co_authors.push((name, email.clone()))
}
}
if !project.is_local()
+1 -1
View File
@@ -1009,7 +1009,7 @@ async fn do_create_worktree(
{
existing_worktree_names.push(name.to_string());
}
existing_worktree_paths.insert(worktree.path.clone());
existing_worktree_paths.insert(worktree.path);
}
}
Ok(Err(err)) => {
+1 -1
View File
@@ -3816,7 +3816,7 @@ pub const fn relative(fraction: f32) -> DefiniteLength {
/// Returns the Golden Ratio, i.e. `~(1.0 + sqrt(5.0)) / 2.0`.
pub const fn phi() -> DefiniteLength {
relative(1.618_034)
relative(std::f32::consts::GOLDEN_RATIO)
}
/// Constructs a `Rems` value representing a length in rems.
+4 -5
View File
@@ -741,7 +741,7 @@ pub(crate) struct TraceGuard;
#[cfg(any(feature = "bench-support", all(test, feature = "profiler")))]
pub(crate) fn trace_scope() -> TraceGuard {
let incremented = TRACE_STATE.fetch_update(Ordering::AcqRel, Ordering::Acquire, |state| {
let incremented = TRACE_STATE.try_update(Ordering::AcqRel, Ordering::Acquire, |state| {
(state & TRACE_SCOPE_COUNT_MASK < TRACE_SCOPE_COUNT_MASK).then_some(state + 1)
});
assert!(incremented.is_ok(), "too many active profiler trace scopes");
@@ -751,10 +751,9 @@ pub(crate) fn trace_scope() -> TraceGuard {
#[cfg(any(feature = "bench-support", all(test, feature = "profiler")))]
impl Drop for TraceGuard {
fn drop(&mut self) {
let previous_state =
TRACE_STATE.fetch_update(Ordering::AcqRel, Ordering::Acquire, |state| {
(state & TRACE_SCOPE_COUNT_MASK > 0).then_some(state - 1)
});
let previous_state = TRACE_STATE.try_update(Ordering::AcqRel, Ordering::Acquire, |state| {
(state & TRACE_SCOPE_COUNT_MASK > 0).then_some(state - 1)
});
match previous_state {
Ok(1) => clear_trace_buffers(),
Ok(_) => {}
+1 -1
View File
@@ -442,7 +442,7 @@ impl ForegroundRunnableCounter {
fn finished(&self) {
let _ = self
.0
.fetch_update(Ordering::AcqRel, Ordering::Acquire, |count| {
.try_update(Ordering::AcqRel, Ordering::Acquire, |count| {
count.checked_sub(1)
});
}
+1 -1
View File
@@ -5565,7 +5565,7 @@ impl Window {
frame_index,
};
self.sprite_atlas.remove(&params.clone().into());
self.sprite_atlas.remove(&params.into());
}
Ok(())
+1 -2
View File
@@ -27,8 +27,6 @@ harness = false
[features]
runtime_shaders = ["gpui_apple/runtime_shaders"]
[dependencies]
gpui.workspace = true
[target.'cfg(target_os = "ios")'.dev-dependencies]
gpui_platform.workspace = true
@@ -39,6 +37,7 @@ slotmap.workspace = true
anyhow.workspace = true
block2.workspace = true
futures.workspace = true
gpui.workspace = true
gpui_apple = { workspace = true, features = ["font-kit"] }
log.workspace = true
objc2.workspace = true
+1 -1
View File
@@ -12,7 +12,7 @@
* The project to which this file belongs is licensed under either of
* the Apache 2.0 or the MIT license at the licensee's choice. The terms
* and conditions of the chosen license apply to this file.
*/
*/
// More info about using the clipboard on X11:
// https://tronche.com/gui/x/icccm/sec-2.html#s-2.6
+1 -2
View File
@@ -364,8 +364,7 @@ impl CosmicTextSystemState {
cached.clone()
} else {
let loaded = self.load_family(fallback_name, features, None)?;
self.font_ids_by_family_cache
.insert(fb_key.clone(), loaded.clone());
self.font_ids_by_family_cache.insert(fb_key, loaded.clone());
loaded
};
let Some(&fb_id) = fb_ids.first() else {
+1 -2
View File
@@ -17,8 +17,6 @@ default = ["gpui/default"]
test-support = ["gpui/test-support"]
screen-capture = ["gpui/screen-capture", "scap"]
[dependencies]
gpui.workspace = true
[target.'cfg(target_os = "windows")'.dependencies]
accesskit.workspace = true
@@ -28,6 +26,7 @@ collections.workspace = true
dunce.workspace = true
etagere.workspace = true
futures.workspace = true
gpui.workspace = true
gpui_util.workspace = true
image.workspace = true
itertools.workspace = true
+1 -1
View File
@@ -334,7 +334,7 @@ impl ConflictState {
.context
.and_then(|ctx| gpui::KeyBindingContextPredicate::parse(&ctx).ok());
let entry = action_keybind_mapping
.entry(mapping.keystrokes.clone())
.entry(mapping.keystrokes)
.or_default();
let origin = ConflictOrigin::new(binding.source, index);
if let Some((_, origins)) =
+1 -1
View File
@@ -1456,7 +1456,7 @@ impl Buffer {
if is_included {
edits.push((
edit.old.clone(),
self.text_for_range(edit.new.clone()).collect::<String>(),
self.text_for_range(edit.new).collect::<String>(),
));
}
}
+3
View File
@@ -4,6 +4,9 @@ version = "0.1.0"
edition.workspace = true
publish = false
[lints]
workspace = true
[lib]
path = "src/language_core.rs"
doctest = false
+1 -1
View File
@@ -381,7 +381,7 @@ mod tests {
cache
.get(&small_key, [small_text].into_iter())
.map(|highlights| highlights.runs),
Some(small_highlights.runs.clone()),
Some(small_highlights.runs),
"highlights within the entry budget must be cached as-is"
);
+1 -1
View File
@@ -748,7 +748,7 @@ impl LanguageModelCostInfo {
}
fn cost_value_to_string(cost: &f64) -> SharedString {
if (cost.fract() - 0.0).abs() < std::f64::EPSILON {
if (cost.fract() - 0.0).abs() < f64::EPSILON {
SharedString::from(format!("{:.0}", cost))
} else {
SharedString::from(format!("{:.2}", cost))
+5 -8
View File
@@ -404,8 +404,6 @@ impl LanguageServerState {
status_color,
{
let lsp_logs = lsp_logs.clone();
let message = message.clone();
let server_selector = server_selector.clone();
let workspace = self.workspace.clone();
let lsp_store = self.lsp_store.clone();
let state = cx.entity().downgrade();
@@ -1164,7 +1162,7 @@ impl LspButton {
};
if let Some(worktree_name) = worktree_name {
servers_per_worktree
.entry(worktree_name.clone())
.entry(worktree_name)
.or_default()
.push(server_data);
}
@@ -1210,14 +1208,13 @@ impl LspButton {
.or_else(|| worktrees_for_name.iter().next())
{
let worktree_name = SharedString::new(worktree.read(cx).root_name_str());
servers_per_worktree
.entry(worktree_name.clone())
.or_default()
.push(ServerData::WithBinaryStatus {
servers_per_worktree.entry(worktree_name).or_default().push(
ServerData::WithBinaryStatus {
server_name,
binary_status,
server_id: *server_id,
});
},
);
}
}
+3 -7
View File
@@ -40,7 +40,6 @@ serde.workspace = true
serde_urlencoded.workspace = true
settings.workspace = true
smallvec.workspace = true
ui.workspace = true
util.workspace = true
[target.'cfg(any(all(target_os = "windows", target_env = "gnu"), target_os = "freebsd"))'.dependencies]
@@ -59,6 +58,9 @@ webrtc-sys.workspace = true
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "windows"))'.dependencies]
scap.workspace = true
[target.'cfg(not(target_os = "macos"))'.dependencies]
ui.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
objc2-core-foundation = { workspace = true, features = ["CFDictionary", "CFNumber"] }
objc2-core-video = { workspace = true, features = ["CVBase", "CVPixelBuffer", "CVPixelBufferIOSurface", "CVPixelBufferPool", "CVReturn"] }
@@ -73,9 +75,3 @@ nanoid.workspace = true
postage = { workspace = true, features = ["futures-traits", "logging"] }
simplelog.workspace = true
[build-dependencies]
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
[package.metadata.cargo-shear]
ignored = ["serde_json"]
+8 -10
View File
@@ -3006,16 +3006,14 @@ impl Element for MarkdownElement {
)
.fill();
let checkbox = if let Some(on_toggle) =
self.on_checkbox_toggle.clone()
{
let task_source_range = task_range.clone();
checkbox.on_click(move |_state, window, cx| {
on_toggle(task_source_range.clone(), !checked, window, cx);
})
} else {
checkbox.visualization_only(true)
};
let checkbox =
if let Some(on_toggle) = self.on_checkbox_toggle.clone() {
checkbox.on_click(move |_state, window, cx| {
on_toggle(task_range.clone(), !checked, window, cx);
})
} else {
checkbox.visualization_only(true)
};
let line_height = self
.style
+3 -6
View File
@@ -575,7 +575,7 @@ pub(crate) fn parse_markdown_with_options(
let mut last_len = parsed.len();
let mut ranges = vec![TextRange {
source_range: range.clone(),
source_range: range,
merged_range: 0..last_len,
parsed,
}];
@@ -597,7 +597,7 @@ pub(crate) fn parse_markdown_with_options(
};
let next_len = last_len + next_text.len();
ranges.push(TextRange {
source_range: next_range.clone(),
source_range: next_range,
merged_range: last_len..next_len,
parsed: next_text,
});
@@ -689,10 +689,7 @@ pub(crate) fn parse_markdown_with_options(
for (range, event) in link_events {
state.push_event(range, event);
}
state.push_event(
link_range.clone(),
MarkdownEvent::End(MarkdownTagEnd::Link),
);
state.push_event(link_range, MarkdownEvent::End(MarkdownTagEnd::Link));
}
}
+2 -2
View File
@@ -1560,7 +1560,7 @@ impl MultiBuffer {
original_indent_columns.push(original_indent_column);
insertions.push((
buffer.anchor_before(range.start)..buffer.anchor_before(range.end),
new_text.clone(),
new_text,
));
} else if !range.is_empty() {
deletions.push((
@@ -3012,7 +3012,7 @@ impl MultiBuffer {
new_diff_transforms.push(
DiffTransform::DeletedHunk {
base_text_byte_range: hunk.diff_base_byte_range.clone(),
base_text_byte_range: hunk.diff_base_byte_range,
summary: base_text_summary,
buffer_id: buffer_snapshot.remote_id(),
hunk_info,
@@ -6876,7 +6876,7 @@ fn check_multibuffer_edits(
.text_for_range(edit.new.start..edit.new.end)
.collect();
text.replace_range(
(edit.new.start.0..edit.new.start.0 + (edit.old.end.0 - edit.old.start.0)).clone(),
edit.new.start.0..edit.new.start.0 + (edit.old.end.0 - edit.old.start.0),
&new_text,
);
pretty_assertions::assert_eq!(
+4 -4
View File
@@ -1179,8 +1179,8 @@ impl OpenAiResponseEventMapper {
Ok(input) => {
events.push(Ok(LanguageModelCompletionEvent::ToolUse(
LanguageModelToolUse {
id: LanguageModelToolUseId::from(call_id.clone()),
name: name.clone(),
id: LanguageModelToolUseId::from(call_id),
name,
is_input_complete: true,
input: LanguageModelToolUseInput::Json(input),
raw_input: arguments.clone(),
@@ -1190,8 +1190,8 @@ impl OpenAiResponseEventMapper {
}
Err(error) => {
events.push(Ok(LanguageModelCompletionEvent::ToolUseJsonParseError {
id: LanguageModelToolUseId::from(call_id.clone()),
tool_name: name.clone(),
id: LanguageModelToolUseId::from(call_id),
tool_name: name,
raw_input: Arc::<str>::from(arguments.clone()),
json_parse_error: error.to_string(),
}));
@@ -37,7 +37,6 @@ use std::{
atomic::{self, AtomicBool},
},
time::Duration,
u32,
};
use outline_panel_settings::{DockSide, FolderIndicator, OutlinePanelSettings, ShowIndentGuides};
+3 -3
View File
@@ -362,7 +362,7 @@ impl AgentServerStore {
CustomAgentServerSettings::Custom { command, .. } => {
let agent_name = AgentId(name.clone().into());
self.external_agents.insert(
agent_name.clone(),
agent_name,
ExternalAgentEntry::new(
Box::new(LocalCustomAgent {
command: command.clone(),
@@ -394,7 +394,7 @@ impl AgentServerStore {
}
self.external_agents.insert(
agent_name.clone(),
agent_name,
ExternalAgentEntry::new(
Box::new(LocalRegistryArchiveAgent {
fs: fs.clone(),
@@ -419,7 +419,7 @@ impl AgentServerStore {
}
RegistryAgent::Npx(agent) => {
self.external_agents.insert(
agent_name.clone(),
agent_name,
ExternalAgentEntry::new(
Box::new(LocalRegistryNpxAgent {
fs: fs.clone(),
+1 -2
View File
@@ -2791,8 +2791,7 @@ impl Session {
pub fn refresh_watchers(&mut self, frame_id: u64, cx: &mut Context<Self>) {
let watches = self.watchers.clone();
for (_, watch) in watches.into_iter() {
self.add_watcher(watch.expression.clone(), frame_id, cx)
.detach();
self.add_watcher(watch.expression, frame_id, cx).detach();
}
}
@@ -378,7 +378,7 @@ impl DiffBufferList {
);
output.push(DiffBuffer {
repo_path: item.repo_path.clone(),
repo_path: item.repo_path,
load: task,
file_status: status,
});
+1 -1
View File
@@ -6525,7 +6525,7 @@ impl LspStore {
worktree_path,
language.name(),
language.manifest(),
delegate.clone(),
delegate,
cx,
)
.collect::<Vec<_>>();
@@ -356,7 +356,7 @@ fn flatten_document_symbols(
output.push(OutlineItem {
depth,
range,
selection_range: selection_range.clone(),
selection_range,
source_range_for_text,
text: text.into(),
highlight_ranges: Vec::new(),
+1 -1
View File
@@ -1099,7 +1099,7 @@ impl WorktreeStore {
let push_strong_handle =
self.retain_worktrees || old_worktree.read(cx).is_visible();
let handle = if push_strong_handle {
WorktreeHandle::Strong(old_worktree.clone())
WorktreeHandle::Strong(old_worktree)
} else {
WorktreeHandle::Weak(old_worktree.downgrade())
};
@@ -103,7 +103,7 @@ mod integration {
for &(path_str, rows) in entries {
let path = project_path(path_str);
map.insert(
path.clone(),
path,
rows.iter().map(|&row| serialized_bookmark(row)).collect(),
);
}
@@ -63,7 +63,7 @@ fn only_whole_label_matches_are_allowed() {
for (color_str, _) in COLOR_TABLE.iter() {
let color = extract_color(&CompletionItem {
kind: Some(CompletionItemKind::COLOR),
label: format!("{} foo", color_str).to_string(),
label: format!("{} foo", color_str),
detail: None,
documentation: None,
..Default::default()
@@ -94,7 +94,7 @@ fn only_whole_detail_matches_are_allowed() {
let color = extract_color(&CompletionItem {
kind: Some(CompletionItemKind::COLOR),
label: "".to_string(),
detail: Some(format!("{} foo", color_str).to_string()),
detail: Some(format!("{} foo", color_str)),
documentation: None,
..Default::default()
});
@@ -110,9 +110,7 @@ fn can_extract_from_documentation_start() {
kind: Some(CompletionItemKind::COLOR),
label: "".to_string(),
detail: None,
documentation: Some(Documentation::String(
format!("{} foo", color_str).to_string(),
)),
documentation: Some(Documentation::String(format!("{} foo", color_str))),
..Default::default()
});
@@ -127,9 +125,7 @@ fn can_extract_from_documentation_end() {
kind: Some(CompletionItemKind::COLOR),
label: "".to_string(),
detail: None,
documentation: Some(Documentation::String(
format!("foo {}", color_str).to_string(),
)),
documentation: Some(Documentation::String(format!("foo {}", color_str))),
..Default::default()
});
@@ -144,9 +140,7 @@ fn cannot_extract_from_documentation_middle() {
kind: Some(CompletionItemKind::COLOR),
label: "".to_string(),
detail: None,
documentation: Some(Documentation::String(
format!("foo {} foo", color_str).to_string(),
)),
documentation: Some(Documentation::String(format!("foo {} foo", color_str))),
..Default::default()
});
+1 -1
View File
@@ -1916,7 +1916,7 @@ impl SshConnectionOptions {
'outer: while let Some(arg) = tokens.next() {
if ALLOWED_OPTS.contains(&(&arg as &str)) {
args.push(arg.to_string());
args.push(arg);
continue;
}
if arg == "-p" {
+2 -1
View File
@@ -52,10 +52,11 @@ log.workspace = true
# Used only by the `nixos-test` helper binary to parse its check list; gated
# behind the `nixos-test` feature so normal builds don't pull it in.
serde = { workspace = true, features = ["derive"], optional = true }
serde_json = { workspace = true, optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
libc.workspace = true
# The `nixos-test` helper binary only parses its check list on Linux.
serde_json = { workspace = true, optional = true }
# Safe wrappers for the SCM_RIGHTS fd-passing and `fstat` the bind validator
# needs, so that code doesn't hand-roll `msghdr`/`CMSG_*`/`mem::zeroed` unsafe.
nix = { workspace = true, features = ["fs", "socket", "uio"] }
+1 -1
View File
@@ -2626,7 +2626,7 @@ impl SettingsWindow {
continue;
};
missing_worktrees.push((worktree_id, directory_name.clone()));
missing_worktrees.push((worktree_id, directory_name));
let path = RelPath::empty().to_owned().into_arc();
let settings_ui_file = SettingsUiFile::Project((worktree_id, path));
+1 -3
View File
@@ -2703,7 +2703,6 @@ impl Sidebar {
{
let this = this.clone();
let key = key.clone();
let workspace = workspace.clone();
move |window, cx| {
this.update(cx, |sidebar, cx| {
sidebar.set_group_expanded(&key, true, cx);
@@ -3061,13 +3060,12 @@ impl Sidebar {
let activate_weak_menu = weak_menu.clone();
let close_weak_menu = weak_menu.clone();
let activate_workspace = workspace.clone();
let close_workspace = workspace.clone();
menu = menu.custom_entry(
move |_window, _cx| {
let close_multi_workspace = close_multi_workspace.clone();
let close_weak_menu = close_weak_menu.clone();
let close_workspace = close_workspace.clone();
let close_workspace = workspace.clone();
let row_group_name = SharedString::from(format!(
"workspace-menu-row-{workspace_index}"
));
+1 -1
View File
@@ -295,7 +295,7 @@ fn test_random_edits(mut rng: StdRng) {
subscription_edits,
);
let mut text = old_buffer.visible_text.clone();
let mut text = old_buffer.visible_text;
for edit in subscription_edits.into_inner() {
let new_text: String = buffer.text_for_range(edit.new.clone()).collect();
text.replace(edit.new.start..edit.new.start + edit.old.len(), &new_text);
-1
View File
@@ -1379,7 +1379,6 @@ impl TitleBar {
},
{
let user_store = user_store.clone();
let organization = organization.clone();
let workspace = workspace.clone();
move |window, cx| {
let task = user_store.update(cx, |user_store, cx| {
+1 -1
View File
@@ -11,7 +11,7 @@ use language::{CharKind, Point, Selection, SelectionGoal, TextObject, TreeSitter
use multi_buffer::MultiBufferRow;
use schemars::JsonSchema;
use serde::Deserialize;
use std::{f64, ops::Range};
use std::ops::Range;
use workspace::searchable::Direction;
+1 -4
View File
@@ -27,10 +27,7 @@ actions!(
fn should_replay(action: &dyn Action) -> bool {
// skip so that we don't leave the character palette open
if editor::actions::ShowCharacterPalette.partial_eq(action) {
return false;
}
true
!editor::actions::ShowCharacterPalette.partial_eq(action)
}
fn repeatable_insert(action: &ReplayableAction) -> Option<Box<dyn Action>> {
+1 -1
View File
@@ -143,7 +143,7 @@ fn cover_or_next<I: Iterator<Item = (Range<MultiBufferOffset>, Range<MultiBuffer
end: end_off.to_display_point(map),
},
open_range: open_range.clone(),
close_range: close_range.clone(),
close_range,
};
if open_range
+1 -1
View File
@@ -1412,7 +1412,7 @@ impl RegistersView {
if let Some(register) = globals.read_register(Some(name), None, cx) {
matches.push(RegisterMatch {
name,
contents: register.text.clone(),
contents: register.text,
})
}
}
+1 -1
View File
@@ -280,7 +280,7 @@ mod tests {
}));
for receiver_id in 0..16 {
let executor = cx.executor().clone();
let executor = cx.executor();
let next_id = next_id.clone();
let closed = closed.clone();
let mut rx = rx.clone();
+4 -6
View File
@@ -1423,12 +1423,10 @@ impl WorkspaceDb {
for (path, bookmark) in bookmarks {
let path: Arc<Path> = path.into();
map.entry(path.clone())
.or_default()
.push(SerializedBookmark {
row: bookmark.row,
label: bookmark.label,
})
map.entry(path).or_default().push(SerializedBookmark {
row: bookmark.row,
label: bookmark.label,
})
}
map
+1 -1
View File
@@ -3123,7 +3123,7 @@ impl Workspace {
.insert(project_path.clone());
}
history.insert(project_path, (fs_path, std::usize::MAX));
history.insert(project_path, (fs_path, usize::MAX));
}
}
+6 -8
View File
@@ -1526,7 +1526,7 @@ impl LocalWorktree {
repository_dir_abs_path: Some(
new_repo.repository_dir_abs_path.clone(),
),
common_dir_abs_path: Some(new_repo.common_dir_abs_path.clone()),
common_dir_abs_path: Some(new_repo.common_dir_abs_path),
});
new_repos.next();
}
@@ -1550,7 +1550,7 @@ impl LocalWorktree {
changes.push(UpdatedGitRepository {
work_directory_id: new_entry_id,
old_work_directory_abs_path: Some(
old_repo.work_directory_abs_path.clone(),
old_repo.work_directory_abs_path,
),
new_work_directory_abs_path: Some(
new_repo.work_directory_abs_path.clone(),
@@ -1559,7 +1559,7 @@ impl LocalWorktree {
repository_dir_abs_path: Some(
new_repo.repository_dir_abs_path.clone(),
),
common_dir_abs_path: Some(new_repo.common_dir_abs_path.clone()),
common_dir_abs_path: Some(new_repo.common_dir_abs_path),
});
}
new_repos.next();
@@ -1568,9 +1568,7 @@ impl LocalWorktree {
Ordering::Greater => {
changes.push(UpdatedGitRepository {
work_directory_id: old_entry_id,
old_work_directory_abs_path: Some(
old_repo.work_directory_abs_path.clone(),
),
old_work_directory_abs_path: Some(old_repo.work_directory_abs_path),
new_work_directory_abs_path: None,
dot_git_abs_path: None,
repository_dir_abs_path: None,
@@ -1587,7 +1585,7 @@ impl LocalWorktree {
new_work_directory_abs_path: Some(repo.work_directory_abs_path.clone()),
dot_git_abs_path: Some(repo.dot_git_abs_path.clone()),
repository_dir_abs_path: Some(repo.repository_dir_abs_path.clone()),
common_dir_abs_path: Some(repo.common_dir_abs_path.clone()),
common_dir_abs_path: Some(repo.common_dir_abs_path),
});
new_repos.next();
}
@@ -1598,7 +1596,7 @@ impl LocalWorktree {
new_work_directory_abs_path: None,
dot_git_abs_path: Some(repo.dot_git_abs_path.clone()),
repository_dir_abs_path: Some(repo.repository_dir_abs_path.clone()),
common_dir_abs_path: Some(repo.common_dir_abs_path.clone()),
common_dir_abs_path: Some(repo.common_dir_abs_path),
});
old_repos.next();
}
@@ -3851,17 +3851,15 @@ async fn test_random_worktree_operations_during_initial_scan(
let settings = worktree.read_with(cx, |tree, _| tree.as_local().unwrap().settings());
for (i, snapshot) in snapshots.into_iter().enumerate().rev() {
let mut updated_snapshot = snapshot.clone();
for (i, mut snapshot) in snapshots.into_iter().enumerate().rev() {
for update in updates.lock().iter() {
if update.scan_id >= updated_snapshot.scan_id() as u64 {
updated_snapshot
.apply_remote_update(update.clone(), &settings.file_scan_inclusions);
if update.scan_id >= snapshot.scan_id() as u64 {
snapshot.apply_remote_update(update.clone(), &settings.file_scan_inclusions);
}
}
assert_eq!(
updated_snapshot.entries(true, 0).collect::<Vec<_>>(),
snapshot.entries(true, 0).collect::<Vec<_>>(),
final_snapshot.entries(true, 0).collect::<Vec<_>>(),
"wrong updates after snapshot {i}: {updates:#?}",
);
+2 -2
View File
@@ -799,9 +799,9 @@ fn assemble_patch_from_edits(
&& let Some(cursor_offset) = cursor_in_new_text
{
cursor = Some(HashRegionCursor {
path: path.clone(),
path,
cursor_offset_in_new_text: cursor_offset,
new_text: new_text.clone(),
new_text,
old_text: old_text.to_string(),
start_row,
});
+3
View File
@@ -5,6 +5,9 @@ edition.workspace = true
publish.workspace = true
license = "Apache-2.0"
[lints]
workspace = true
[lib]
proc-macro = true
test = false