address clippy lints

This commit is contained in:
Ferdinand Schober
2023-12-10 15:23:57 +01:00
parent 5c8ea25563
commit ebf5a64f20
13 changed files with 116 additions and 117 deletions

View File

@@ -80,7 +80,7 @@ impl LibeiConsumer {
let context = ei::Context::new(stream)?; let context = ei::Context::new(stream)?;
context.flush()?; context.flush()?;
let events = EiEventStream::new(context.clone())?; let events = EiEventStream::new(context.clone())?;
return Ok(Self { Ok(Self {
handshake: false, handshake: false,
context, context,
events, events,
@@ -96,7 +96,7 @@ impl LibeiConsumer {
capability_mask: 0, capability_mask: 0,
sequence: 0, sequence: 0,
serial: 0, serial: 0,
}); })
} }
} }

View File

@@ -267,7 +267,7 @@ impl VirtualInput {
// insert a frame event after each mouse event // insert a frame event after each mouse event
pointer.frame(); pointer.frame();
} }
_ => {} VirtualInput::Kde { .. } => {}
} }
} }
Event::Keyboard(e) => match e { Event::Keyboard(e) => match e {
@@ -330,11 +330,8 @@ impl Dispatch<WlKeyboard, ()> for State {
_: &Connection, _: &Connection,
_: &QueueHandle<Self>, _: &QueueHandle<Self>,
) { ) {
match event { if let wl_keyboard::Event::Keymap { format, fd, size } = event {
wl_keyboard::Event::Keymap { format, fd, size } => { state.keymap = Some((u32::from(format), fd, size));
state.keymap = Some((u32::from(format), fd, size));
}
_ => {}
} }
} }
} }

View File

@@ -30,6 +30,12 @@ impl X11Consumer {
} }
} }
impl Default for X11Consumer {
fn default() -> Self {
Self::new()
}
}
#[async_trait] #[async_trait]
impl EventConsumer for X11Consumer { impl EventConsumer for X11Consumer {
async fn consume(&mut self, event: Event, _: ClientHandle) { async fn consume(&mut self, event: Event, _: ClientHandle) {

View File

@@ -159,7 +159,7 @@ impl Window {
let layer_surface = g.layer_shell.get_layer_surface( let layer_surface = g.layer_shell.get_layer_surface(
&surface, &surface,
Some(&output), Some(output),
Layer::Overlay, Layer::Overlay,
"LAN Mouse Sharing".into(), "LAN Mouse Sharing".into(),
qh, qh,
@@ -221,13 +221,7 @@ fn get_output_configuration(state: &State, pos: Position) -> Vec<(WlOutput, Outp
// as an opposite edge of a different output // as an opposite edge of a different output
let outputs: Vec<WlOutput> = edges let outputs: Vec<WlOutput> = edges
.iter() .iter()
.filter(|(_, edge)| { .filter(|(_, edge)| !opposite_edges.iter().map(|(_, e)| *e).any(|e| &e == edge))
opposite_edges
.iter()
.map(|(_, e)| *e)
.find(|e| e == edge)
.is_none()
})
.map(|(o, _)| o.clone()) .map(|(o, _)| o.clone())
.collect(); .collect();
state state
@@ -244,7 +238,7 @@ fn draw(f: &mut File, (width, height): (u32, u32)) {
for _ in 0..width { for _ in 0..width {
if env::var("LM_DEBUG_LAYER_SHELL").ok().is_some() { if env::var("LM_DEBUG_LAYER_SHELL").ok().is_some() {
// AARRGGBB // AARRGGBB
buf.write_all(&0xFF11d116u32.to_ne_bytes()).unwrap(); buf.write_all(&0xff11d116u32.to_ne_bytes()).unwrap();
} else { } else {
// AARRGGBB // AARRGGBB
buf.write_all(&0x00000000u32.to_ne_bytes()).unwrap(); buf.write_all(&0x00000000u32.to_ne_bytes()).unwrap();
@@ -468,7 +462,7 @@ impl State {
let outputs = get_output_configuration(self, pos); let outputs = get_output_configuration(self, pos);
outputs.iter().for_each(|(o, i)| { outputs.iter().for_each(|(o, i)| {
let window = Window::new(&self, &self.qh, &o, pos, i.size); let window = Window::new(self, &self.qh, o, pos, i.size);
let window = Rc::new(window); let window = Rc::new(window);
self.client_for_window.push((window, client)); self.client_for_window.push((window, client));
}); });
@@ -545,19 +539,15 @@ impl EventProducer for WaylandEventProducer {
} }
ClientEvent::Destroy(handle) => { ClientEvent::Destroy(handle) => {
let inner = self.0.get_mut(); let inner = self.0.get_mut();
loop { // remove all windows corresponding to this client
// remove all windows corresponding to this client while let Some(i) = inner
if let Some(i) = inner .state
.state .client_for_window
.client_for_window .iter()
.iter() .position(|(_, c)| *c == handle)
.position(|(_, c)| *c == handle) {
{ inner.state.client_for_window.remove(i);
inner.state.client_for_window.remove(i); inner.state.focused = None;
inner.state.focused = None;
} else {
break;
}
} }
} }
} }
@@ -663,7 +653,7 @@ impl Dispatch<wl_pointer::WlPointer, ()> for State {
.find(|(w, _c)| w.surface == surface) .find(|(w, _c)| w.surface == surface)
{ {
app.focused = Some((window.clone(), *client)); app.focused = Some((window.clone(), *client));
app.grab(&surface, pointer, serial.clone(), qh); app.grab(&surface, pointer, serial, qh);
} else { } else {
return; return;
} }
@@ -834,7 +824,7 @@ impl Dispatch<ZwlrLayerSurfaceV1, ()> for State {
// client corresponding to the layer_surface // client corresponding to the layer_surface
let surface = &window.surface; let surface = &window.surface;
let buffer = &window.buffer; let buffer = &window.buffer;
surface.attach(Some(&buffer), 0, 0); surface.attach(Some(buffer), 0, 0);
layer_surface.ack_configure(serial); layer_surface.ack_configure(serial);
surface.commit(); surface.commit();
} }
@@ -869,16 +859,15 @@ impl Dispatch<wl_registry::WlRegistry, ()> for State {
name, name,
interface, interface,
version: _, version: _,
} => match interface.as_str() { } => {
"wl_output" => { if interface.as_str() == "wl_output" {
log::debug!("wl_output global"); log::debug!("wl_output global");
state state
.g .g
.outputs .outputs
.push(registry.bind::<wl_output::WlOutput, _, _>(name, 4, qh, ())) .push(registry.bind::<wl_output::WlOutput, _, _>(name, 4, qh, ()))
} }
_ => {} }
},
wl_registry::Event::GlobalRemove { .. } => {} wl_registry::Event::GlobalRemove { .. } => {}
_ => {} _ => {}
} }

View File

@@ -16,6 +16,12 @@ impl X11Producer {
} }
} }
impl Default for X11Producer {
fn default() -> Self {
Self::new()
}
}
impl EventProducer for X11Producer { impl EventProducer for X11Producer {
fn notify(&mut self, _: ClientEvent) {} fn notify(&mut self, _: ClientEvent) {}

View File

@@ -89,6 +89,12 @@ pub struct ClientManager {
clients: Vec<Option<ClientState>>, // HashMap likely not beneficial clients: Vec<Option<ClientState>>, // HashMap likely not beneficial
} }
impl Default for ClientManager {
fn default() -> Self {
Self::new()
}
}
impl ClientManager { impl ClientManager {
pub fn new() -> Self { pub fn new() -> Self {
Self { clients: vec![] } Self { clients: vec![] }
@@ -174,12 +180,12 @@ impl ClientManager {
} }
// returns an immutable reference to the client state corresponding to `client` // returns an immutable reference to the client state corresponding to `client`
pub fn get<'a>(&'a self, client: ClientHandle) -> Option<&'a ClientState> { pub fn get(&self, client: ClientHandle) -> Option<&ClientState> {
self.clients.get(client as usize)?.as_ref() self.clients.get(client as usize)?.as_ref()
} }
/// returns a mutable reference to the client state corresponding to `client` /// returns a mutable reference to the client state corresponding to `client`
pub fn get_mut<'a>(&'a mut self, client: ClientHandle) -> Option<&'a mut ClientState> { pub fn get_mut(&mut self, client: ClientHandle) -> Option<&mut ClientState> {
self.clients.get_mut(client as usize)?.as_mut() self.clients.get_mut(client as usize)?.as_mut()
} }

View File

@@ -111,11 +111,11 @@ impl Display for Event {
impl Event { impl Event {
fn event_type(&self) -> EventType { fn event_type(&self) -> EventType {
match self { match self {
Self::Pointer(_) => EventType::POINTER, Self::Pointer(_) => EventType::Pointer,
Self::Keyboard(_) => EventType::KEYBOARD, Self::Keyboard(_) => EventType::Keyboard,
Self::Release() => EventType::RELEASE, Self::Release() => EventType::Release,
Self::Ping() => EventType::PING, Self::Ping() => EventType::Ping,
Self::Pong() => EventType::PONG, Self::Pong() => EventType::Pong,
} }
} }
} }
@@ -123,10 +123,10 @@ impl Event {
impl PointerEvent { impl PointerEvent {
fn event_type(&self) -> PointerEventType { fn event_type(&self) -> PointerEventType {
match self { match self {
Self::Motion { .. } => PointerEventType::MOTION, Self::Motion { .. } => PointerEventType::Motion,
Self::Button { .. } => PointerEventType::BUTTON, Self::Button { .. } => PointerEventType::Button,
Self::Axis { .. } => PointerEventType::AXIS, Self::Axis { .. } => PointerEventType::Axis,
Self::Frame { .. } => PointerEventType::FRAME, Self::Frame { .. } => PointerEventType::Frame,
} }
} }
} }
@@ -134,28 +134,28 @@ impl PointerEvent {
impl KeyboardEvent { impl KeyboardEvent {
fn event_type(&self) -> KeyboardEventType { fn event_type(&self) -> KeyboardEventType {
match self { match self {
KeyboardEvent::Key { .. } => KeyboardEventType::KEY, KeyboardEvent::Key { .. } => KeyboardEventType::Key,
KeyboardEvent::Modifiers { .. } => KeyboardEventType::MODIFIERS, KeyboardEvent::Modifiers { .. } => KeyboardEventType::Modifiers,
} }
} }
} }
enum PointerEventType { enum PointerEventType {
MOTION, Motion,
BUTTON, Button,
AXIS, Axis,
FRAME, Frame,
} }
enum KeyboardEventType { enum KeyboardEventType {
KEY, Key,
MODIFIERS, Modifiers,
} }
enum EventType { enum EventType {
POINTER, Pointer,
KEYBOARD, Keyboard,
RELEASE, Release,
PING, Ping,
PONG, Pong,
} }
impl TryFrom<u8> for PointerEventType { impl TryFrom<u8> for PointerEventType {
@@ -163,10 +163,10 @@ impl TryFrom<u8> for PointerEventType {
fn try_from(value: u8) -> Result<Self, Self::Error> { fn try_from(value: u8) -> Result<Self, Self::Error> {
match value { match value {
x if x == Self::MOTION as u8 => Ok(Self::MOTION), x if x == Self::Motion as u8 => Ok(Self::Motion),
x if x == Self::BUTTON as u8 => Ok(Self::BUTTON), x if x == Self::Button as u8 => Ok(Self::Button),
x if x == Self::AXIS as u8 => Ok(Self::AXIS), x if x == Self::Axis as u8 => Ok(Self::Axis),
x if x == Self::FRAME as u8 => Ok(Self::FRAME), x if x == Self::Frame as u8 => Ok(Self::Frame),
_ => Err(Box::new(ProtocolError { _ => Err(Box::new(ProtocolError {
msg: format!("invalid pointer event type {}", value), msg: format!("invalid pointer event type {}", value),
})), })),
@@ -179,8 +179,8 @@ impl TryFrom<u8> for KeyboardEventType {
fn try_from(value: u8) -> Result<Self, Self::Error> { fn try_from(value: u8) -> Result<Self, Self::Error> {
match value { match value {
x if x == Self::KEY as u8 => Ok(Self::KEY), x if x == Self::Key as u8 => Ok(Self::Key),
x if x == Self::MODIFIERS as u8 => Ok(Self::MODIFIERS), x if x == Self::Modifiers as u8 => Ok(Self::Modifiers),
_ => Err(Box::new(ProtocolError { _ => Err(Box::new(ProtocolError {
msg: format!("invalid keyboard event type {}", value), msg: format!("invalid keyboard event type {}", value),
})), })),
@@ -188,17 +188,17 @@ impl TryFrom<u8> for KeyboardEventType {
} }
} }
impl Into<Vec<u8>> for &Event { impl From<&Event> for Vec<u8> {
fn into(self) -> Vec<u8> { fn from(event: &Event) -> Self {
let event_id = vec![self.event_type() as u8]; let event_id = vec![event.event_type() as u8];
let event_data = match self { let event_data = match event {
Event::Pointer(p) => p.into(), Event::Pointer(p) => p.into(),
Event::Keyboard(k) => k.into(), Event::Keyboard(k) => k.into(),
Event::Release() => vec![], Event::Release() => vec![],
Event::Ping() => vec![], Event::Ping() => vec![],
Event::Pong() => vec![], Event::Pong() => vec![],
}; };
vec![event_id, event_data].concat() [event_id, event_data].concat()
} }
} }
@@ -220,11 +220,11 @@ impl TryFrom<Vec<u8>> for Event {
fn try_from(value: Vec<u8>) -> Result<Self, Self::Error> { fn try_from(value: Vec<u8>) -> Result<Self, Self::Error> {
let event_id = u8::from_be_bytes(value[..1].try_into()?); let event_id = u8::from_be_bytes(value[..1].try_into()?);
match event_id { match event_id {
i if i == (EventType::POINTER as u8) => Ok(Event::Pointer(value.try_into()?)), i if i == (EventType::Pointer as u8) => Ok(Event::Pointer(value.try_into()?)),
i if i == (EventType::KEYBOARD as u8) => Ok(Event::Keyboard(value.try_into()?)), i if i == (EventType::Keyboard as u8) => Ok(Event::Keyboard(value.try_into()?)),
i if i == (EventType::RELEASE as u8) => Ok(Event::Release()), i if i == (EventType::Release as u8) => Ok(Event::Release()),
i if i == (EventType::PING as u8) => Ok(Event::Ping()), i if i == (EventType::Ping as u8) => Ok(Event::Ping()),
i if i == (EventType::PONG as u8) => Ok(Event::Pong()), i if i == (EventType::Pong as u8) => Ok(Event::Pong()),
_ => Err(Box::new(ProtocolError { _ => Err(Box::new(ProtocolError {
msg: format!("invalid event_id {}", event_id), msg: format!("invalid event_id {}", event_id),
})), })),
@@ -232,10 +232,10 @@ impl TryFrom<Vec<u8>> for Event {
} }
} }
impl Into<Vec<u8>> for &PointerEvent { impl From<&PointerEvent> for Vec<u8> {
fn into(self) -> Vec<u8> { fn from(event: &PointerEvent) -> Self {
let id = vec![self.event_type() as u8]; let id = vec![event.event_type() as u8];
let data = match self { let data = match event {
PointerEvent::Motion { PointerEvent::Motion {
time, time,
relative_x, relative_x,
@@ -244,7 +244,7 @@ impl Into<Vec<u8>> for &PointerEvent {
let time = time.to_be_bytes(); let time = time.to_be_bytes();
let relative_x = relative_x.to_be_bytes(); let relative_x = relative_x.to_be_bytes();
let relative_y = relative_y.to_be_bytes(); let relative_y = relative_y.to_be_bytes();
vec![&time[..], &relative_x[..], &relative_y[..]].concat() [&time[..], &relative_x[..], &relative_y[..]].concat()
} }
PointerEvent::Button { PointerEvent::Button {
time, time,
@@ -254,19 +254,19 @@ impl Into<Vec<u8>> for &PointerEvent {
let time = time.to_be_bytes(); let time = time.to_be_bytes();
let button = button.to_be_bytes(); let button = button.to_be_bytes();
let state = state.to_be_bytes(); let state = state.to_be_bytes();
vec![&time[..], &button[..], &state[..]].concat() [&time[..], &button[..], &state[..]].concat()
} }
PointerEvent::Axis { time, axis, value } => { PointerEvent::Axis { time, axis, value } => {
let time = time.to_be_bytes(); let time = time.to_be_bytes();
let axis = axis.to_be_bytes(); let axis = axis.to_be_bytes();
let value = value.to_be_bytes(); let value = value.to_be_bytes();
vec![&time[..], &axis[..], &value[..]].concat() [&time[..], &axis[..], &value[..]].concat()
} }
PointerEvent::Frame {} => { PointerEvent::Frame {} => {
vec![] vec![]
} }
}; };
vec![id, data].concat() [id, data].concat()
} }
} }
@@ -281,7 +281,7 @@ impl TryFrom<Vec<u8>> for PointerEvent {
Err(e) => return Err(e), Err(e) => return Err(e),
}; };
match event_type { match event_type {
PointerEventType::MOTION => { PointerEventType::Motion => {
let time = match data.get(2..6) { let time = match data.get(2..6) {
Some(d) => u32::from_be_bytes(d.try_into()?), Some(d) => u32::from_be_bytes(d.try_into()?),
None => { None => {
@@ -312,7 +312,7 @@ impl TryFrom<Vec<u8>> for PointerEvent {
relative_y, relative_y,
}) })
} }
PointerEventType::BUTTON => { PointerEventType::Button => {
let time = match data.get(2..6) { let time = match data.get(2..6) {
Some(d) => u32::from_be_bytes(d.try_into()?), Some(d) => u32::from_be_bytes(d.try_into()?),
None => { None => {
@@ -343,7 +343,7 @@ impl TryFrom<Vec<u8>> for PointerEvent {
state, state,
}) })
} }
PointerEventType::AXIS => { PointerEventType::Axis => {
let time = match data.get(2..6) { let time = match data.get(2..6) {
Some(d) => u32::from_be_bytes(d.try_into()?), Some(d) => u32::from_be_bytes(d.try_into()?),
None => { None => {
@@ -370,7 +370,7 @@ impl TryFrom<Vec<u8>> for PointerEvent {
}; };
Ok(Self::Axis { time, axis, value }) Ok(Self::Axis { time, axis, value })
} }
PointerEventType::FRAME => Ok(Self::Frame {}), PointerEventType::Frame => Ok(Self::Frame {}),
} }
} }
None => Err(Box::new(ProtocolError { None => Err(Box::new(ProtocolError {
@@ -380,15 +380,15 @@ impl TryFrom<Vec<u8>> for PointerEvent {
} }
} }
impl Into<Vec<u8>> for &KeyboardEvent { impl From<&KeyboardEvent> for Vec<u8> {
fn into(self) -> Vec<u8> { fn from(event: &KeyboardEvent) -> Self {
let id = vec![self.event_type() as u8]; let id = vec![event.event_type() as u8];
let data = match self { let data = match event {
KeyboardEvent::Key { time, key, state } => { KeyboardEvent::Key { time, key, state } => {
let time = time.to_be_bytes(); let time = time.to_be_bytes();
let key = key.to_be_bytes(); let key = key.to_be_bytes();
let state = state.to_be_bytes(); let state = state.to_be_bytes();
vec![&time[..], &key[..], &state[..]].concat() [&time[..], &key[..], &state[..]].concat()
} }
KeyboardEvent::Modifiers { KeyboardEvent::Modifiers {
mods_depressed, mods_depressed,
@@ -400,7 +400,7 @@ impl Into<Vec<u8>> for &KeyboardEvent {
let mods_latched = mods_latched.to_be_bytes(); let mods_latched = mods_latched.to_be_bytes();
let mods_locked = mods_locked.to_be_bytes(); let mods_locked = mods_locked.to_be_bytes();
let group = group.to_be_bytes(); let group = group.to_be_bytes();
vec![ [
&mods_depressed[..], &mods_depressed[..],
&mods_latched[..], &mods_latched[..],
&mods_locked[..], &mods_locked[..],
@@ -409,7 +409,7 @@ impl Into<Vec<u8>> for &KeyboardEvent {
.concat() .concat()
} }
}; };
vec![id, data].concat() [id, data].concat()
} }
} }
@@ -424,7 +424,7 @@ impl TryFrom<Vec<u8>> for KeyboardEvent {
Err(e) => return Err(e), Err(e) => return Err(e),
}; };
match event_type { match event_type {
KeyboardEventType::KEY => { KeyboardEventType::Key => {
let time = match data.get(2..6) { let time = match data.get(2..6) {
Some(d) => u32::from_be_bytes(d.try_into()?), Some(d) => u32::from_be_bytes(d.try_into()?),
None => { None => {
@@ -451,7 +451,7 @@ impl TryFrom<Vec<u8>> for KeyboardEvent {
}; };
Ok(KeyboardEvent::Key { time, key, state }) Ok(KeyboardEvent::Key { time, key, state })
} }
KeyboardEventType::MODIFIERS => { KeyboardEventType::Modifiers => {
let mods_depressed = match data.get(2..6) { let mods_depressed = match data.get(2..6) {
Some(d) => u32::from_be_bytes(d.try_into()?), Some(d) => u32::from_be_bytes(d.try_into()?),
None => { None => {

View File

@@ -229,11 +229,11 @@ impl FrontendListener {
// TODO do simultaneously // TODO do simultaneously
for tx in self.tx_streams.iter_mut() { for tx in self.tx_streams.iter_mut() {
// write len + payload // write len + payload
if let Err(_) = tx.write(&len).await { if tx.write(&len).await.is_err() {
keep.push(false); keep.push(false);
continue; continue;
} }
if let Err(_) = tx.write(payload).await { if tx.write(payload).await.is_err() {
keep.push(false); keep.push(false);
continue; continue;
} }

View File

@@ -21,7 +21,7 @@ pub fn run() -> Result<()> {
let socket_path = super::FrontendListener::socket_path()?; let socket_path = super::FrontendListener::socket_path()?;
#[cfg(unix)] #[cfg(unix)]
let Ok(mut tx) = UnixStream::connect(&socket_path) else { let Ok(mut tx) = UnixStream::connect(socket_path) else {
return Err(anyhow!("Could not connect to lan-mouse-socket")); return Err(anyhow!("Could not connect to lan-mouse-socket"));
}; };

View File

@@ -175,7 +175,7 @@ fn build_ui(app: &Application) {
let index = param.unwrap() let index = param.unwrap()
.get::<u32>() .get::<u32>()
.unwrap(); .unwrap();
let Some(client) = window.clients().item(index as u32) else { let Some(client) = window.clients().item(index) else {
return; return;
}; };
let client = client.downcast_ref::<ClientObject>().unwrap(); let client = client.downcast_ref::<ClientObject>().unwrap();

View File

@@ -63,7 +63,7 @@ impl ClientRow {
let port_binding = client_object let port_binding = client_object
.bind_property("port", &self.imp().port.get(), "text") .bind_property("port", &self.imp().port.get(), "text")
.transform_from(|_, v: String| { .transform_from(|_, v: String| {
if v == "" { if v.is_empty() {
Some(DEFAULT_PORT as u32) Some(DEFAULT_PORT as u32)
} else { } else {
Some(v.parse::<u16>().unwrap_or(DEFAULT_PORT) as u32) Some(v.parse::<u16>().unwrap_or(DEFAULT_PORT) as u32)

View File

@@ -85,16 +85,13 @@ impl Window {
} }
pub fn client_idx(&self, handle: ClientHandle) -> Option<usize> { pub fn client_idx(&self, handle: ClientHandle) -> Option<usize> {
self.clients() self.clients().iter::<ClientObject>().position(|c| {
.iter::<ClientObject>() if let Ok(c) = c {
.position(|c| { c.handle() == handle
if let Ok(c) = c { } else {
c.handle() == handle false
} else { }
false })
}
})
.map(|p| p as usize)
} }
pub fn delete_client(&self, handle: ClientHandle) { pub fn delete_client(&self, handle: ClientHandle) {
@@ -117,7 +114,7 @@ impl Window {
pub fn request_port_change(&self) { pub fn request_port_change(&self) {
let port = self.imp().port_entry.get().text().to_string(); let port = self.imp().port_entry.get().text().to_string();
if let Ok(port) = u16::from_str_radix(port.as_str(), 10) { if let Ok(port) = port.as_str().parse::<u16>() {
self.request(FrontendEvent::ChangePort(port)); self.request(FrontendEvent::ChangePort(port));
} else { } else {
self.request(FrontendEvent::ChangePort(DEFAULT_PORT)); self.request(FrontendEvent::ChangePort(DEFAULT_PORT));

View File

@@ -132,9 +132,7 @@ impl Server {
// safety: cancellation safe // safety: cancellation safe
e = self.consumer.dispatch() => { e = self.consumer.dispatch() => {
log::trace!("-> consumer.dispatch()"); log::trace!("-> consumer.dispatch()");
if let Err(e) = e { e?;
return Err(e);
}
} }
// safety: cancellation safe // safety: cancellation safe
_ = signal::ctrl_c() => { _ = signal::ctrl_c() => {