Skip to content

Commit f3cda7b

Browse files
committed
Fix clippy lints
and test write access
1 parent 64fcdeb commit f3cda7b

File tree

6 files changed

+10
-17
lines changed

6 files changed

+10
-17
lines changed

src/blocks/networkmanager.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum DeviceType {
9090
Wifi,
9191
Modem,
9292
Bridge,
93-
TUN,
93+
Tun,
9494
Wireguard,
9595
}
9696

@@ -102,7 +102,7 @@ impl From<u32> for DeviceType {
102102
2 => DeviceType::Wifi,
103103
8 => DeviceType::Modem,
104104
13 => DeviceType::Bridge,
105-
16 => DeviceType::TUN,
105+
16 => DeviceType::Tun,
106106
29 => DeviceType::Wireguard,
107107
_ => DeviceType::Unknown,
108108
}
@@ -116,7 +116,7 @@ impl DeviceType {
116116
DeviceType::Wifi => Some("net_wireless".to_string()),
117117
DeviceType::Modem => Some("net_modem".to_string()),
118118
DeviceType::Bridge => Some("net_bridge".to_string()),
119-
DeviceType::TUN => Some("net_bridge".to_string()),
119+
DeviceType::Tun => Some("net_bridge".to_string()),
120120
DeviceType::Wireguard => Some("net_vpn".to_string()),
121121
_ => None,
122122
}
@@ -127,6 +127,7 @@ impl DeviceType {
127127
struct Ipv4Address {
128128
address: Ipv4Addr,
129129
prefix: u32,
130+
#[allow(dead_code)]
130131
gateway: Ipv4Addr,
131132
}
132133

@@ -491,6 +492,7 @@ pub struct NetworkManagerConfig {
491492
pub interface_name_include: Vec<String>,
492493
}
493494

495+
#[allow(clippy::derivable_impls)]
494496
impl Default for NetworkManagerConfig {
495497
fn default() -> Self {
496498
Self {

src/blocks/notify.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,13 @@ pub struct Notify {
2828
output: TextWidget,
2929
}
3030

31-
#[derive(Deserialize, Debug, Clone)]
31+
#[derive(Deserialize, Debug, Default, Clone)]
3232
#[serde(deny_unknown_fields, default)]
3333
pub struct NotifyConfig {
3434
/// Format string which describes the output of this block.
3535
pub format: FormatTemplate,
3636
}
3737

38-
impl Default for NotifyConfig {
39-
fn default() -> Self {
40-
Self {
41-
// display just the bell icon
42-
format: FormatTemplate::default(),
43-
}
44-
}
45-
}
46-
4738
impl ConfigBlock for Notify {
4839
type Config = NotifyConfig;
4940

src/errors.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ impl<T> OptionExt<T> for ::std::option::Option<T> {
5959

6060
/// A set of errors that can occur during the runtime of i3status-rs.
6161
/// TODO: rewrite using struct-like fields ("what is the order of InternalError again?")
62+
/// TODO: rename variants
63+
#[allow(clippy::enum_variant_names)]
6264
pub enum Error {
6365
BlockError(String, String),
6466
ConfigurationError(String, String),

src/protocol/i3bar_event.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ pub enum MouseButton {
2424
struct I3BarEventInternal {
2525
pub name: Option<String>,
2626
pub instance: Option<String>,
27+
#[allow(dead_code)]
2728
pub x: u64,
29+
#[allow(dead_code)]
2830
pub y: u64,
2931

3032
#[serde(deserialize_with = "deserialize_mousebutton")]

src/widgets/rotatingtext.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::util::escape_pango_text;
88

99
#[derive(Clone, Debug)]
1010
pub struct RotatingTextWidget {
11-
id: usize,
1211
pub instance: usize,
1312
pub rotating: bool,
1413
rotation_pos: usize,
@@ -43,7 +42,6 @@ impl RotatingTextWidget {
4342
};
4443

4544
RotatingTextWidget {
46-
id,
4745
instance,
4846
rotation_pos: 0,
4947
max_width,

src/widgets/text.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::protocol::i3bar_block::I3BarBlock;
55

66
#[derive(Clone, Debug)]
77
pub struct TextWidget {
8-
id: usize,
98
pub instance: usize,
109
content: Option<String>,
1110
content_short: Option<String>,
@@ -29,7 +28,6 @@ impl TextWidget {
2928
};
3029

3130
TextWidget {
32-
id,
3331
instance,
3432
content: None,
3533
content_short: None,

0 commit comments

Comments
 (0)