Skip to content

Commit 861e099

Browse files
committed
clean up clippy warnings
1 parent b1179af commit 861e099

11 files changed

Lines changed: 37 additions & 31 deletions

File tree

README.org

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ Options:
9696
--tcp-port <tcp-port> TCP port for video stream (default: 6680)
9797
--ssh-key <ssh-key> Private SSH key file path. If not specified, attempting all keys in the SSH directory
9898
--framerate <framerate> Framerate (default: 50)
99-
--dark-mode Dark mode - invert colors (default: false)
10099
--show-cursor Show cursor (default: false)
101100
-h, --help Print help
102101
-V, --version Print version
@@ -109,7 +108,6 @@ Corresponding keys:
109108
- =REMARKABLE_TCP_PORT=
110109
- =REMARKABLE_SSH_KEY_PATH=
111110
- =REMARKABLE_FRAMERATE=
112-
- =REMARKABLE_DARK_MODE=
113111
- =REMARKABLE_SHOW_CURSOR=
114112

115113
* Building

client/src/config.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ pub struct CliOptions {
3333
framerate: Option<f32>,
3434

3535
/// Dark mode - invert colors (default: false)
36-
#[arg(long, name = "dark-mode")]
37-
dark_mode: bool,
36+
//#[arg(long, name = "dark-mode")]
37+
//dark_mode: bool,
3838

3939
/// Show cursor (default: false)
4040
#[arg(long, name = "show-cursor")]
@@ -45,7 +45,8 @@ pub struct CliOptions {
4545
pub struct ClientOptions {
4646
pub remarkable_ip: String,
4747
pub ssh_key: Option<PathBuf>,
48-
pub dark_mode: bool,
48+
// TODO: implement dark mode
49+
// pub dark_mode: bool,
4950
pub tcp_port: u16,
5051
pub show_cursor: bool,
5152
pub framerate: f32,
@@ -82,7 +83,7 @@ impl From<CliOptions> for ClientOptions {
8283
},
8384
DEFAULT_FRAMERATE,
8485
),
85-
dark_mode: resolve_boolean_option(value.dark_mode, "REMARKABLE_DARK_MODE", false),
86+
//dark_mode: resolve_boolean_option(value.dark_mode, "REMARKABLE_DARK_MODE", false),
8687
show_cursor: resolve_boolean_option(value.show_cursor, "REMARKABLE_SHOW_CURSOR", false),
8788
}
8889
}
@@ -136,10 +137,11 @@ fn resolve_with<T>(
136137
"read environment variable '{}': {:?}",
137138
variable_name, env_string,
138139
);
139-
parse(env_string.unwrap_or_else(|_| panic!("could not get environment varialbe '{}'",
140-
variable_name)))
141-
.unwrap_or_else(|_| panic!("could not parse environemt variable '{}'",
142-
variable_name))
140+
parse(
141+
env_string
142+
.unwrap_or_else(|_| panic!("could not get environment varialbe '{}'", variable_name)),
143+
)
144+
.unwrap_or_else(|_| panic!("could not parse environemt variable '{}'", variable_name))
143145
}
144146

145147
fn resolve_with_optional<T>(
@@ -161,8 +163,9 @@ fn resolve_with_optional<T>(
161163
"read environment variable '{}': {}",
162164
variable_name, env_string,
163165
);
164-
return Some(parse(env_string).unwrap_or_else(|_| panic!("could not parse environemt variable '{}'",
165-
variable_name)));
166+
return Some(parse(env_string).unwrap_or_else(|_| {
167+
panic!("could not parse environemt variable '{}'", variable_name)
168+
}));
166169
}
167170

168171
None

client/src/connection/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ impl Connection {
120120
.map(|_| ())
121121
}
122122

123+
#[allow(unused)]
123124
async fn send_raw(&mut self, msg: Bytes) -> Result<(), Error> {
124125
self.framed
125126
.send(msg)

client/src/display/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
use anyhow::{Context, Error};
42
use gstreamer_app::AppSrc;
53
use gstreamer_video::VideoFormat;
@@ -9,7 +7,8 @@ use gstreamer::{Pipeline, prelude::*};
97

108
#[derive(Debug)]
119
pub struct Display {
12-
pipeline: Pipeline,
10+
#[allow(unused)]
11+
pipeline: Pipeline, // only for keeping alive (TODO: check if realy needed)
1312
appsrc: AppSrc,
1413
}
1514

server/src/config/device.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub struct DeviceConfig {
5252
}
5353

5454
impl DeviceConfig {
55+
#[allow(unused)]
5556
pub fn new(version_info: VersionInfo) -> Result<Self, Error> {
5657
let height = 1872;
5758
let width = 1404;

server/src/connection/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl Connection {
7777
Ok(stream_config)
7878
}
7979

80+
#[allow(unused)]
8081
async fn receive_raw(&mut self) -> Result<BytesMut, Error> {
8182
self.framed
8283
.next()

server/src/connection/ssh/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl Connection {
123123
fn get_authorized_key_matching_signature(
124124
token: &AuthentificationToken,
125125
signature: &SshSig,
126-
authorized_keys: &Vec<Entry>,
126+
authorized_keys: &[Entry],
127127
) -> Option<PublicKey> {
128128
authorized_keys
129129
.iter()

server/src/connection/video.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::time::Duration;
22

33
use anyhow::{Context, Error};
4-
use futures::SinkExt;
54
use lz4_flex::compress_prepend_size;
65
use tokio::time::{MissedTickBehavior, interval};
76
use tracing::{debug, trace};

server/src/framebuffer/process.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn get_process() -> Result<Process, Error> {
2323

2424
let process = processes.next().context("no xochitl process found")?;
2525

26-
if let Some(_) = processes.next() {
26+
if processes.next().is_some() {
2727
return Err(anyhow!("found more than one xochitl process"));
2828
}
2929

@@ -37,18 +37,17 @@ fn get_framebuffer_offset_in_process_memory(process: &Process) -> Result<usize,
3737
let framebuffer_path_name =
3838
MMapPath::from("/dev/fb0").context("could not build framebuffer path name")?;
3939

40-
let matches_path_name = |m: &&MemoryMap| m.pathname == framebuffer_path_name;
40+
let matches_path_name = |m: &MemoryMap| m.pathname == framebuffer_path_name;
4141

4242
let maps = process.maps().context("could not get process maps")?;
43-
4443
let mut maps = maps.iter().skip_while(|m| !matches_path_name(m)).skip(1);
4544

4645
let framebuffer_map = maps.next().expect("found no framebuffer map");
46+
let offset = framebuffer_map.address.0 as usize;
4747

48-
if maps.find(matches_path_name).is_some() {
48+
if maps.any(matches_path_name) {
4949
return Err(anyhow!("found more than one framebuffer map"));
5050
}
5151

52-
let offset = framebuffer_map.address.0 as usize;
5352
Ok(offset)
5453
}

server/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use tracing::{error, info};
1313
use tracing_subscriber::{Registry, fmt, layer::SubscriberExt};
1414

1515
use connection::{Connection, video::VideoConnection};
16-
use version::VersionInfo;
1716

1817
#[tokio::main]
1918
async fn main() -> Result<(), Error> {

0 commit comments

Comments
 (0)