Skip to content

Commit 137081f

Browse files
authored
Misc code cleanups accumulated while working on other changes (#34787)
Release Notes: - N/A
1 parent 7c1040b commit 137081f

File tree

7 files changed

+9
-21
lines changed

7 files changed

+9
-21
lines changed

crates/command_palette/src/command_palette.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl CommandPaletteDelegate {
242242
self.selected_ix = cmp::min(self.selected_ix, self.matches.len() - 1);
243243
}
244244
}
245-
///
245+
246246
/// Hit count for each command in the palette.
247247
/// We only account for commands triggered directly via command palette and not by e.g. keystrokes because
248248
/// if a user already knows a keystroke for a command, they are unlikely to use a command palette to look for it.

crates/dap/src/registry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ impl DapRegistry {
4646
let name = adapter.name();
4747
let _previous_value = self.0.write().adapters.insert(name, adapter);
4848
}
49+
4950
pub fn add_locator(&self, locator: Arc<dyn DapLocator>) {
5051
self.0.write().locators.insert(locator.name(), locator);
5152
}

crates/gpui/examples/set_menus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
});
3535
}
3636

37-
// Associate actions using the `actions!` macro (or `impl_actions!` macro)
37+
// Associate actions using the `actions!` macro (or `Action` derive macro)
3838
actions!(set_menus, [Quit]);
3939

4040
// Define the quit function that is registered with the App

crates/gpui/src/app.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,9 @@ impl App {
13701370
self.keymap.clone()
13711371
}
13721372

1373-
/// Register a global listener for actions invoked via the keyboard.
1373+
/// Register a global handler for actions invoked via the keyboard. These handlers are run at
1374+
/// the end of the bubble phase for actions, and so will only be invoked if there are no other
1375+
/// handlers or if they called `cx.propagate()`.
13741376
pub fn on_action<A: Action>(&mut self, listener: impl Fn(&A, &mut Self) + 'static) {
13751377
self.global_action_listeners
13761378
.entry(TypeId::of::<A>())

crates/migrator/src/migrations/m_2025_04_15/keymap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn replace_string_action(
2525
None
2626
}
2727

28-
/// "ctrl-k ctrl-1": "inline_completion::ToggleMenu" -> "edit_prediction::ToggleMenu"
28+
/// "space": "outline_panel::Open" -> "outline_panel::OpenSelectedEntry"
2929
static STRING_REPLACE: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
3030
HashMap::from_iter([("outline_panel::Open", "outline_panel::OpenSelectedEntry")])
3131
});

crates/theme/src/schema.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use anyhow::Result;
44
use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance};
55
use indexmap::IndexMap;
66
use palette::FromColor;
7-
use schemars::{JsonSchema, json_schema};
7+
use schemars::{JsonSchema, JsonSchema_repr};
88
use serde::{Deserialize, Deserializer, Serialize};
99
use serde_json::Value;
1010
use serde_repr::{Deserialize_repr, Serialize_repr};
11-
use std::borrow::Cow;
1211

1312
use crate::{StatusColorsRefinement, ThemeColorsRefinement};
1413

@@ -1486,7 +1485,7 @@ impl From<FontStyleContent> for FontStyle {
14861485
}
14871486
}
14881487

1489-
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq)]
1488+
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, JsonSchema_repr, PartialEq)]
14901489
#[repr(u16)]
14911490
pub enum FontWeightContent {
14921491
Thin = 100,
@@ -1500,19 +1499,6 @@ pub enum FontWeightContent {
15001499
Black = 900,
15011500
}
15021501

1503-
impl JsonSchema for FontWeightContent {
1504-
fn schema_name() -> Cow<'static, str> {
1505-
"FontWeightContent".into()
1506-
}
1507-
1508-
fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
1509-
json_schema!({
1510-
"type": "integer",
1511-
"enum": [100, 200, 300, 400, 500, 600, 700, 800, 900]
1512-
})
1513-
}
1514-
}
1515-
15161502
impl From<FontWeightContent> for FontWeight {
15171503
fn from(value: FontWeightContent) -> Self {
15181504
match value {

crates/util/src/schemars.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub fn replace_subschema<T: JsonSchema>(
1515
generator: &mut schemars::SchemaGenerator,
1616
schema: impl Fn() -> schemars::Schema,
1717
) -> schemars::Schema {
18-
// fallback on just using the schema name, which could collide.
1918
let schema_name = T::schema_name();
2019
let definitions = generator.definitions_mut();
2120
assert!(!definitions.contains_key(&format!("{schema_name}2")));

0 commit comments

Comments
 (0)