1
0
mirror of https://gitlab.com/marcandre.lureau/qemu-display.git synced 2025-04-14 08:44:46 +00:00

chore: fix clippy warnings

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2025-01-08 16:09:56 +04:00
parent faeaa413a8
commit ed9de1453c
3 changed files with 12 additions and 16 deletions

View File

@ -47,7 +47,7 @@ impl DisplayHandler {
}
async fn listen(&self) -> Result<DisplayUpdates> {
let (sender, receiver) = DisplayQueue::new();
let (sender, receiver) = DisplayQueue::channel();
let (width, height) = (
self.console.width().await? as _,
self.console.height().await? as _,

View File

@ -63,7 +63,7 @@ impl Drop for Receiver {
}
impl DisplayQueue {
pub(crate) fn new() -> (Sender, Receiver) {
pub(crate) fn channel() -> (Sender, Receiver) {
let channel = Arc::new(DisplayQueue {
queue: Mutex::new(VecDeque::with_capacity(QUEUE_CAPACITY)),
notify_producer: Notify::new(),
@ -229,7 +229,7 @@ mod tests {
#[test]
fn test_send_recv() {
let (tx, rx) = DisplayQueue::new();
let (tx, rx) = DisplayQueue::channel();
crate::utils::block_on(async move {
let tx_task = tokio::spawn(async move {
let ops = vec![
@ -252,7 +252,7 @@ mod tests {
#[test]
fn test_capacity() {
let (tx, rx) = DisplayQueue::new();
let (tx, rx) = DisplayQueue::channel();
crate::utils::block_on(async move {
let ops = vec![DefaultPointer; QUEUE_CAPACITY];
for op in ops {
@ -271,7 +271,7 @@ mod tests {
#[test]
fn test_close() {
let (tx, rx) = DisplayQueue::new();
let (tx, rx) = DisplayQueue::channel();
crate::utils::block_on(async move {
let tx_task = tokio::spawn(async move {
drop(tx);
@ -286,7 +286,7 @@ mod tests {
#[test]
fn test_resize() {
let (tx, rx) = DisplayQueue::new();
let (tx, rx) = DisplayQueue::channel();
crate::utils::block_on(async move {
let ops = vec![
Resize(DesktopSize {
@ -333,7 +333,7 @@ mod tests {
#[test]
fn test_bitmap() {
let (tx, rx) = DisplayQueue::new();
let (tx, rx) = DisplayQueue::channel();
crate::utils::block_on(async move {
let ops = vec![
Bitmap(BitmapUpdate {

View File

@ -25,11 +25,11 @@ enum State {
#[derive(Debug)]
pub struct Inner {
audio: Audio,
state: State,
start_time: Instant,
ev_sender: Option<mpsc::UnboundedSender<ServerEvent>>,
rdp_started: bool,
_audio: Option<Audio>,
}
#[derive(Debug)]
@ -170,26 +170,22 @@ impl SoundServerFactory for SoundHandler {
impl SoundHandler {
pub async fn connect(display: &Display<'_>) -> Result<Self> {
let audio =
let mut audio =
Audio::new(display.connection(), Some(display.destination().to_owned())).await?;
let inner = Arc::new(Mutex::new(Inner {
start_time: Instant::now(),
state: State::Init,
ev_sender: None,
audio,
rdp_started: false,
_audio: None,
}));
// TODO: register only after connection?
let handler = DBusHandler {
inner: inner.clone(),
};
inner
.lock()
.unwrap()
.audio
.register_out_listener(handler)
.await?;
audio.register_out_listener(handler).await?;
inner.lock().unwrap()._audio = Some(audio);
Ok(Self { inner })
}