Fix clippy warnings

This commit is contained in:
Ottatop 2024-06-15 20:46:39 -05:00
parent 23b1e9d62a
commit 350468f970
5 changed files with 18 additions and 23 deletions

View file

@ -88,12 +88,9 @@ use signal::SignalState;
#[cfg(feature = "snowcap")] #[cfg(feature = "snowcap")]
use snowcap::Snowcap; use snowcap::Snowcap;
use tag::Tag; use tag::Tag;
use tokio::{ use tokio::sync::{
sync::{ mpsc::{unbounded_channel, UnboundedReceiver},
mpsc::{unbounded_channel, UnboundedReceiver}, RwLock,
RwLock,
},
task::JoinHandle,
}; };
use tokio_stream::wrappers::UnboundedReceiverStream; use tokio_stream::wrappers::UnboundedReceiverStream;
use tonic::transport::{Endpoint, Uri}; use tonic::transport::{Endpoint, Uri};
@ -167,7 +164,7 @@ impl std::fmt::Debug for ApiModules {
pub struct Receivers { pub struct Receivers {
pinnacle: UnboundedReceiver<BoxFuture<'static, ()>>, pinnacle: UnboundedReceiver<BoxFuture<'static, ()>>,
#[cfg(feature = "snowcap")] #[cfg(feature = "snowcap")]
snowcap: UnboundedReceiver<JoinHandle<()>>, snowcap: UnboundedReceiver<tokio::task::JoinHandle<()>>,
} }
/// Connects to Pinnacle and builds the configuration structs. /// Connects to Pinnacle and builds the configuration structs.
@ -238,18 +235,16 @@ pub async fn connect() -> Result<(ApiModules, Receivers), Box<dyn std::error::Er
tag.finish_init(modules.clone()); tag.finish_init(modules.clone());
layout.finish_init(modules.clone()); layout.finish_init(modules.clone());
signal.read().await.finish_init(modules.clone()); signal.read().await.finish_init(modules.clone());
#[cfg(feature = "snowcap")] #[cfg(feature = "snowcap")]
modules.snowcap.finish_init(modules.clone()); modules.snowcap.finish_init(modules.clone());
#[cfg(feature = "snowcap")]
let receivers = Receivers { let receivers = Receivers {
pinnacle: fut_recv, pinnacle: fut_recv,
#[cfg(feature = "snowcap")]
snowcap: snowcap_recv, snowcap: snowcap_recv,
}; };
#[cfg(not(feature = "snowcap"))]
let receivers = Receivers { pinnacle: fut_recv };
Ok((modules, receivers)) Ok((modules, receivers))
} }

View file

@ -12,6 +12,7 @@ pub mod integration;
pub struct Snowcap { pub struct Snowcap {
/// Create layer surface widgets. /// Create layer surface widgets.
pub layer: &'static Layer, pub layer: &'static Layer,
/// Pinnacle integrations.
pub integration: &'static Integration, pub integration: &'static Integration,
} }

@ -1 +1 @@
Subproject commit 62dc3583cb62cc112c5ead9f634576c8109f7ac6 Subproject commit 27ce9a2d8afb48cada5ae965e88ee6b6a141fe23

View file

@ -13,10 +13,6 @@
use std::{ use std::{
io::{BufRead, BufReader}, io::{BufRead, BufReader},
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration, time::Duration,
}; };
@ -27,10 +23,7 @@ use pinnacle::{
state::State, state::State,
util::increase_nofile_rlimit, util::increase_nofile_rlimit,
}; };
use smithay::reexports::{ use smithay::reexports::{calloop::EventLoop, rustix::process::geteuid};
calloop::{self, EventLoop},
rustix::process::geteuid,
};
use tracing::{error, info, warn}; use tracing::{error, info, warn};
use tracing_appender::rolling::Rotation; use tracing_appender::rolling::Rotation;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer};
@ -183,6 +176,12 @@ async fn main() -> anyhow::Result<()> {
#[cfg(feature = "snowcap")] #[cfg(feature = "snowcap")]
{ {
use smithay::reexports::calloop;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
info!("Starting Snowcap"); info!("Starting Snowcap");
let (ping, source) = calloop::ping::make_ping()?; let (ping, source) = calloop::ping::make_ping()?;
let ready_flag = Arc::new(AtomicBool::new(false)); let ready_flag = Arc::new(AtomicBool::new(false));
@ -216,7 +215,7 @@ async fn main() -> anyhow::Result<()> {
info!("`no-config` option was set, not spawning config"); info!("`no-config` option was set, not spawning config");
} }
event_loop.run(None, &mut state, |state| { event_loop.run(Duration::from_secs(1), &mut state, |state| {
state.on_event_loop_cycle_completion(); state.on_event_loop_cycle_completion();
})?; })?;

View file

@ -26,7 +26,7 @@ use smithay::{
input::{keyboard::XkbConfig, pointer::CursorImageStatus, Seat, SeatState}, input::{keyboard::XkbConfig, pointer::CursorImageStatus, Seat, SeatState},
output::Output, output::Output,
reexports::{ reexports::{
calloop::{self, generic::Generic, Interest, LoopHandle, LoopSignal, Mode, PostAction}, calloop::{generic::Generic, Interest, LoopHandle, LoopSignal, Mode, PostAction},
wayland_server::{ wayland_server::{
backend::{ClientData, ClientId, DisconnectReason, GlobalId}, backend::{ClientData, ClientId, DisconnectReason, GlobalId},
protocol::wl_surface::WlSurface, protocol::wl_surface::WlSurface,
@ -157,7 +157,7 @@ pub struct Pinnacle {
pub outputs: IndexMap<Output, Option<GlobalId>>, pub outputs: IndexMap<Output, Option<GlobalId>>,
#[cfg(feature = "snowcap")] #[cfg(feature = "snowcap")]
pub snowcap_shutdown_ping: Option<calloop::ping::Ping>, pub snowcap_shutdown_ping: Option<smithay::reexports::calloop::ping::Ping>,
} }
impl State { impl State {