Skip to content

Commit

Permalink
Fix clippy in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mikayla-maki committed Feb 15, 2024
1 parent 9c79450 commit 9a82cf3
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 29 deletions.
4 changes: 2 additions & 2 deletions crates/gpui/src/platform/linux/blade_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl BladeRenderer {
sprites,
} => {
let tex_info = self.atlas.get_texture_info(texture_id);
let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
let instance_buf = self.instance_belt.alloc_data(sprites, &self.gpu);
let mut encoder = pass.with(&self.pipelines.mono_sprites);
encoder.bind(
0,
Expand All @@ -476,7 +476,7 @@ impl BladeRenderer {
sprites,
} => {
let tex_info = self.atlas.get_texture_info(texture_id);
let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
let instance_buf = self.instance_belt.alloc_data(sprites, &self.gpu);
let mut encoder = pass.with(&self.pipelines.poly_sprites);
encoder.bind(
0,
Expand Down
18 changes: 9 additions & 9 deletions crates/gpui/src/platform/linux/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub(crate) struct LinuxPlatformInner {
}

pub(crate) struct LinuxPlatform {
client: Arc<dyn Client>,
inner: Arc<LinuxPlatformInner>,
client: Rc<dyn Client>,
inner: Rc<LinuxPlatformInner>,
}

pub(crate) struct LinuxPlatformState {
Expand Down Expand Up @@ -93,18 +93,18 @@ impl LinuxPlatform {
let client_dispatcher: Arc<dyn ClientDispatcher + Send + Sync> =
Arc::new(WaylandClientDispatcher::new(&conn));
let dispatcher = Arc::new(LinuxDispatcher::new(main_sender, &client_dispatcher));
let inner = Arc::new(LinuxPlatformInner {
let inner = Rc::new(LinuxPlatformInner {
background_executor: BackgroundExecutor::new(dispatcher.clone()),
foreground_executor: ForegroundExecutor::new(dispatcher.clone()),
main_receiver,
text_system,
callbacks,
state,
});
let client = Arc::new(WaylandClient::new(Arc::clone(&inner), Arc::clone(&conn)));
let client = Rc::new(WaylandClient::new(Rc::clone(&inner), Arc::clone(&conn)));
Self {
client,
inner: Arc::clone(&inner),
inner: Rc::clone(&inner),
}
}

Expand Down Expand Up @@ -135,23 +135,23 @@ impl LinuxPlatform {
let client_dispatcher: Arc<dyn ClientDispatcher + Send + Sync> =
Arc::new(X11ClientDispatcher::new(&xcb_connection, x_root_index));
let dispatcher = Arc::new(LinuxDispatcher::new(main_sender, &client_dispatcher));
let inner = Arc::new(LinuxPlatformInner {
let inner = Rc::new(LinuxPlatformInner {
background_executor: BackgroundExecutor::new(dispatcher.clone()),
foreground_executor: ForegroundExecutor::new(dispatcher.clone()),
main_receiver,
text_system,
callbacks,
state,
});
let client = Arc::new(X11Client::new(
Arc::clone(&inner),
let client = Rc::new(X11Client::new(
Rc::clone(&inner),
xcb_connection,
x_root_index,
atoms,
));
Self {
client,
inner: Arc::clone(&inner),
inner: Rc::clone(&inner),
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions crates/gpui/src/platform/linux/wayland/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,26 @@ pub(crate) struct WaylandClientState {
compositor: Option<wl_compositor::WlCompositor>,
buffer: Option<wl_buffer::WlBuffer>,
wm_base: Option<xdg_wm_base::XdgWmBase>,
windows: Vec<(xdg_surface::XdgSurface, Arc<WaylandWindowState>)>,
platform_inner: Arc<LinuxPlatformInner>,
windows: Vec<(xdg_surface::XdgSurface, Rc<WaylandWindowState>)>,
platform_inner: Rc<LinuxPlatformInner>,
}

pub(crate) struct WaylandClient {
platform_inner: Arc<LinuxPlatformInner>,
platform_inner: Rc<LinuxPlatformInner>,
conn: Arc<Connection>,
state: Mutex<WaylandClientState>,
event_queue: Mutex<EventQueue<WaylandClientState>>,
qh: Arc<QueueHandle<WaylandClientState>>,
}

impl WaylandClient {
pub(crate) fn new(
linux_platform_inner: Arc<LinuxPlatformInner>,
conn: Arc<Connection>,
) -> Self {
pub(crate) fn new(linux_platform_inner: Rc<LinuxPlatformInner>, conn: Arc<Connection>) -> Self {
let state = WaylandClientState {
compositor: None,
buffer: None,
wm_base: None,
windows: Vec::new(),
platform_inner: Arc::clone(&linux_platform_inner),
platform_inner: Rc::clone(&linux_platform_inner),
};
let event_queue: EventQueue<WaylandClientState> = conn.new_event_queue();
let qh = event_queue.handle();
Expand Down Expand Up @@ -109,14 +106,14 @@ impl Client for WaylandClient {
wl_surface.frame(&self.qh, wl_surface.clone());
wl_surface.commit();

let window_state: Arc<WaylandWindowState> = Arc::new(WaylandWindowState::new(
let window_state = Rc::new(WaylandWindowState::new(
&self.conn,
wl_surface.clone(),
Arc::new(toplevel),
options,
));

state.windows.push((xdg_surface, Arc::clone(&window_state)));
state.windows.push((xdg_surface, Rc::clone(&window_state)));
Box::new(WaylandWindow(window_state))
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/gpui/src/platform/linux/wayland/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pub(crate) struct WaylandDisplay {}
impl PlatformDisplay for WaylandDisplay {
// todo!(linux)
fn id(&self) -> DisplayId {
return DisplayId(123); // return some fake data so it doesn't panic
DisplayId(123) // return some fake data so it doesn't panic
}

// todo!(linux)
fn uuid(&self) -> anyhow::Result<Uuid> {
return Ok(Uuid::from_bytes([0; 16])); // return some fake data so it doesn't panic
Ok(Uuid::from_bytes([0; 16])) // return some fake data so it doesn't panic
}

// todo!(linux)
Expand Down
4 changes: 2 additions & 2 deletions crates/gpui/src/platform/linux/wayland/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl WaylandWindowState {
}

#[derive(Clone)]
pub(crate) struct WaylandWindow(pub(crate) Arc<WaylandWindowState>);
pub(crate) struct WaylandWindow(pub(crate) Rc<WaylandWindowState>);

impl HasWindowHandle for WaylandWindow {
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
Expand Down Expand Up @@ -212,7 +212,7 @@ impl PlatformWindow for WaylandWindow {

// todo!(linux)
fn scale_factor(&self) -> f32 {
return 1f32;
1f32
}

//todo!(linux)
Expand Down
4 changes: 2 additions & 2 deletions crates/gpui/src/platform/linux/x11/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) struct X11ClientState {
}

pub(crate) struct X11Client {
platform_inner: Arc<LinuxPlatformInner>,
platform_inner: Rc<LinuxPlatformInner>,
xcb_connection: Arc<xcb::Connection>,
x_root_index: i32,
atoms: XcbAtoms,
Expand All @@ -29,7 +29,7 @@ pub(crate) struct X11Client {

impl X11Client {
pub(crate) fn new(
inner: Arc<LinuxPlatformInner>,
inner: Rc<LinuxPlatformInner>,
xcb_connection: Arc<xcb::Connection>,
x_root_index: i32,
atoms: XcbAtoms,
Expand Down
2 changes: 1 addition & 1 deletion crates/gpui/src/platform/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl X11WindowState {

// Note: this has to be done after the GPU init, or otherwise
// the sizes are immediately invalidated.
let gpu_extent = query_render_extent(&xcb_connection, x_window);
let gpu_extent = query_render_extent(xcb_connection, x_window);

Self {
xcb_connection: Arc::clone(xcb_connection),
Expand Down
2 changes: 1 addition & 1 deletion script/clippy
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ set -euxo pipefail
# so specify those here, and disable the rest until Zed's workspace
# will have more fixes & suppression for the standard lint set
cargo clippy --release --workspace --all-features --all-targets -- -A clippy::all -D clippy::dbg_macro -D clippy::todo
cargo clippy -p gpui
cargo clippy -p gpui -- -D warnings

0 comments on commit 9a82cf3

Please sign in to comment.