Skip to content

Commit 9d80b4d

Browse files
authored
Bump edition to 2024 (#2143)
1 parent c0fded5 commit 9d80b4d

35 files changed

+65
-66
lines changed

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ repos:
5050
language: system
5151
types: [rust]
5252
args: ["--"]
53+
require_serial: true
5354
- id: cargo-clippy
5455
name: cargo clippy
5556
description: Run cargo clippy

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ authors = [
99
"Kai Greshake <[email protected]>",
1010
"Contributors on GitHub (https://github.com/greshake/i3status-rust/graphs/contributors)",
1111
]
12-
edition = "2021"
12+
edition = "2024"
1313

1414
[workspace]
1515
members = [".", "xtask"]
16-
resolver = "2"
16+
resolver = "3"
1717

1818
[features]
1919
default = ["pulseaudio"]

src/blocks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mod prelude;
3232
use futures::future::FutureExt as _;
3333
use futures::stream::FuturesUnordered;
3434
use serde::de::{self, Deserialize};
35-
use tokio::sync::{mpsc, Notify};
35+
use tokio::sync::{Notify, mpsc};
3636

3737
use std::borrow::Cow;
3838
use std::sync::Arc;

src/blocks/battery/upower.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tokio::try_join;
22
use zbus::fdo::{PropertiesChangedStream, PropertiesProxy};
3-
use zbus::{zvariant, Connection};
3+
use zbus::{Connection, zvariant};
44
use zvariant::ObjectPath;
55

66
use super::{BatteryDevice, BatteryInfo, BatteryStatus, DeviceName};

src/blocks/calendar.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
288288
_ => {
289289
return Err(Error::new(
290290
"Currently only one calendar source is supported",
291-
))
291+
));
292292
}
293293
};
294294

@@ -344,15 +344,15 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
344344
_ => {
345345
return Err(Error::new(
346346
"Authorization failed. Check your configurations",
347-
))
347+
));
348348
}
349349
}
350350
}
351351
e => {
352352
return Err(Error {
353353
message: None,
354354
cause: Some(Arc::new(e)),
355-
})
355+
});
356356
}
357357
},
358358
};

src/blocks/calendar/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use oauth2::{
66
PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, RefreshToken, Scope, StandardTokenResponse,
77
TokenResponse as _, TokenUrl,
88
};
9-
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
109
use reqwest::Url;
10+
use reqwest::header::{AUTHORIZATION, HeaderMap, HeaderValue};
1111
use std::path::{Path, PathBuf};
1212
use tokio::fs::File;
1313
use tokio::io::{AsyncBufReadExt as _, AsyncReadExt as _, AsyncWriteExt as _, BufReader};

src/blocks/calendar/caldav.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ use std::{str::FromStr as _, time::Duration, vec};
33
use chrono::{DateTime, Local, Utc};
44
use icalendar::{Component as _, EventLike as _};
55
use reqwest::{
6-
self,
7-
header::{HeaderMap, HeaderValue, CONTENT_TYPE},
8-
ClientBuilder, Method, Url,
6+
self, ClientBuilder, Method, Url,
7+
header::{CONTENT_TYPE, HeaderMap, HeaderValue},
98
};
109
use serde::Deserialize;
1110

1211
use super::{
13-
auth::{Auth, Authorize},
1412
CalendarError,
13+
auth::{Auth, Authorize},
1514
};
1615

1716
#[derive(Clone, Debug)]

src/blocks/keyboard_layout/xkb_event.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use super::*;
22
use x11rb_async::{
33
connection::{Connection as _, RequestConnection as _},
44
protocol::{
5+
Event,
56
xkb::{
6-
self, ConnectionExt as _, EventType, MapPart, NameDetail, SelectEventsAux,
7-
UseExtensionReply, ID,
7+
self, ConnectionExt as _, EventType, ID, MapPart, NameDetail, SelectEventsAux,
8+
UseExtensionReply,
89
},
910
xproto::ConnectionExt as _,
10-
Event,
1111
},
1212
rust_connection::RustConnection,
1313
};

src/blocks/memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
7373
use std::cmp::min;
7474
use std::str::FromStr as _;
75-
use tokio::fs::{read_dir, File};
75+
use tokio::fs::{File, read_dir};
7676
use tokio::io::{AsyncBufReadExt as _, BufReader};
7777

7878
use super::prelude::*;

src/blocks/menu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
3434
use tokio::sync::mpsc::UnboundedReceiver;
3535

36-
use super::{prelude::*, BlockAction};
36+
use super::{BlockAction, prelude::*};
3737
use crate::subprocess::spawn_shell;
3838

3939
#[derive(Deserialize, Debug)]

src/blocks/packages/apt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22
use std::process::Stdio;
33

4-
use tokio::fs::{create_dir_all, File};
4+
use tokio::fs::{File, create_dir_all};
55
use tokio::process::Command;
66

77
use super::*;

src/blocks/prelude.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
pub use super::{BlockAction, CommonApi};
22

3+
pub(crate) use crate::REQWEST_CLIENT;
4+
pub(crate) use crate::REQWEST_CLIENT_IPV4;
35
pub use crate::click::MouseButton;
46
pub use crate::errors::*;
5-
pub use crate::formatting::{config::Config as FormatConfig, value::Value, Values};
7+
pub use crate::formatting::{Values, config::Config as FormatConfig, value::Value};
68
pub use crate::util::{default, new_dbus_connection, new_system_dbus_connection};
79
pub use crate::widget::{State, Widget};
810
pub use crate::wrappers::{Seconds, ShellString};
9-
pub(crate) use crate::REQWEST_CLIENT;
10-
pub(crate) use crate::REQWEST_CLIENT_IPV4;
1111

1212
pub use serde::Deserialize;
1313

src/blocks/privacy/v4l.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use debounced::{debounced, Debounced};
1+
use debounced::{Debounced, debounced};
22
use inotify::{EventStream, Inotify, WatchDescriptor, WatchMask, Watches};
3-
use tokio::fs::{read_dir, File};
4-
use tokio::time::{interval, Interval};
3+
use tokio::fs::{File, read_dir};
4+
use tokio::time::{Interval, interval};
55

66
use std::path::PathBuf;
77

src/blocks/sound/pulseaudio.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use std::thread;
88
use libc::c_void;
99
use libpulse_binding::callbacks::ListResult;
1010
use libpulse_binding::context::{
11-
introspect::ServerInfo, introspect::SinkInfo, introspect::SourceInfo, subscribe::Facility,
12-
subscribe::InterestMaskSet, Context, FlagSet, State as PulseState,
11+
Context, FlagSet, State as PulseState, introspect::ServerInfo, introspect::SinkInfo,
12+
introspect::SourceInfo, subscribe::Facility, subscribe::InterestMaskSet,
1313
};
1414
use libpulse_binding::mainloop::api::MainloopApi;
1515
use libpulse_binding::mainloop::standard::{IterateResult, Mainloop};
16-
use libpulse_binding::proplist::{properties, Proplist};
16+
use libpulse_binding::proplist::{Proplist, properties};
1717
use libpulse_binding::volume::{ChannelVolumes, Volume};
1818
use tokio::sync::Notify;
1919

src/blocks/watson.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//! # TODO
3232
//! - Extend functionality: start / stop watson using this block
3333
34-
use chrono::{offset::Local, DateTime};
34+
use chrono::{DateTime, offset::Local};
3535
use dirs::config_dir;
3636
use inotify::{Inotify, WatchMask};
3737
use serde::de::Deserializer;

src/blocks/weather/met_no.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,11 @@ impl WeatherProvider for Service<'_> {
232232
}
233233

234234
if data.properties.timeseries.len() < forecast_hours {
235-
return Err(Error::new(
236-
format!("Unable to fetch the specified number of forecast_hours specified {}, only {} hours available", forecast_hours, data.properties.timeseries.len()),
237-
))?;
235+
return Err(Error::new(format!(
236+
"Unable to fetch the specified number of forecast_hours specified {}, only {} hours available",
237+
forecast_hours,
238+
data.properties.timeseries.len()
239+
)))?;
238240
}
239241

240242
let data_agg: Vec<ForecastAggregateSegment> = data

src/blocks/weather/open_weather_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22
use chrono::{DateTime, Utc};
3-
use serde::{de, Deserializer};
3+
use serde::{Deserializer, de};
44

55
pub(super) const GEO_URL: &str = "https://api.openweathermap.org/geo/1.0";
66
pub(super) const CURRENT_URL: &str = "https://api.openweathermap.org/data/2.5/weather";

src/click.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt;
22

3-
use serde::de::{self, Deserializer, Visitor};
43
use serde::Deserialize;
4+
use serde::de::{self, Deserializer, Visitor};
55

66
use crate::errors::{ErrorContext as _, Result};
77
use crate::protocol::i3bar_event::I3BarEvent;

src/formatting/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use super::{template::FormatTemplate, Format};
1+
use super::{Format, template::FormatTemplate};
22
use crate::errors::*;
33
use serde::de::{MapAccess, Visitor};
4-
use serde::{de, Deserialize, Deserializer};
4+
use serde::{Deserialize, Deserializer, de};
55
use std::fmt;
66
use std::str::FromStr;
77

src/formatting/formatter.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use unicode_segmentation::UnicodeSegmentation as _;
33
use std::time::Duration;
44
use std::{borrow::Cow, fmt::Debug};
55

6+
use super::FormatError;
67
use super::parse::Arg;
78
use super::value::ValueInner as Value;
8-
use super::FormatError;
99
use crate::config::SharedConfig;
1010
use crate::errors::*;
1111

@@ -28,17 +28,17 @@ pub use bar::BarFormatter;
2828
mod tally;
2929
pub use tally::TallyFormatter;
3030
mod datetime;
31-
pub use datetime::{DatetimeFormatter, DEFAULT_DATETIME_FORMATTER};
31+
pub use datetime::{DEFAULT_DATETIME_FORMATTER, DatetimeFormatter};
3232
mod duration;
33-
pub use duration::{DurationFormatter, DEFAULT_DURATION_FORMATTER};
33+
pub use duration::{DEFAULT_DURATION_FORMATTER, DurationFormatter};
3434
mod eng;
35-
pub use eng::{EngFormatter, DEFAULT_NUMBER_FORMATTER};
35+
pub use eng::{DEFAULT_NUMBER_FORMATTER, EngFormatter};
3636
mod flag;
37-
pub use flag::{FlagFormatter, DEFAULT_FLAG_FORMATTER};
37+
pub use flag::{DEFAULT_FLAG_FORMATTER, FlagFormatter};
3838
mod pango;
3939
pub use pango::PangoStrFormatter;
4040
mod str;
41-
pub use str::{StrFormatter, DEFAULT_STRING_FORMATTER};
41+
pub use str::{DEFAULT_STRING_FORMATTER, StrFormatter};
4242

4343
type PadWith = Cow<'static, str>;
4444

src/formatting/formatter/bar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const VERTICAL_BAR_CHARS: [char; 9] = [
5757
impl Formatter for BarFormatter {
5858
fn format(&self, val: &Value, _config: &SharedConfig) -> Result<String, FormatError> {
5959
match val {
60-
Value::Number { mut val, .. } => {
60+
&Value::Number { mut val, .. } => {
6161
val = (val / self.max_value).clamp(0., 1.);
6262
if self.vertical {
6363
let vert_char = VERTICAL_BAR_CHARS[(val * 8.) as usize];

src/formatting/formatter/eng.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl EngFormatter {
108108
impl Formatter for EngFormatter {
109109
fn format(&self, val: &Value, _config: &SharedConfig) -> Result<String, FormatError> {
110110
match val {
111-
Value::Number { mut val, mut unit } => {
111+
&Value::Number { mut val, mut unit } => {
112112
if !self.range.contains(&val) {
113113
return Err(FormatError::NumberOutOfRange(val));
114114
}

src/formatting/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use std::{any::TypeId, str::FromStr};
22

33
use nom::{
4+
IResult, Parser as _,
45
branch::alt,
56
bytes::complete::{escaped_transform, tag, take_while, take_while1},
67
character::complete::{anychar, char},
78
combinator::{cut, eof, map, not, opt},
89
multi::{many0, separated_list0},
910
sequence::{preceded, separated_pair, terminated, tuple},
10-
IResult, Parser as _,
1111
};
1212

1313
use crate::errors::*;

src/formatting/prefix.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ impl Prefix {
6060
}
6161

6262
pub fn max(self, other: Self) -> Self {
63-
if other > self {
64-
other
65-
} else {
66-
self
67-
}
63+
if other > self { other } else { self }
6864
}
6965

7066
pub fn apply(self, value: f64) -> f64 {

src/formatting/scheduling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::BoxedStream;
22
use futures::stream::StreamExt as _;
33
use std::time::{Duration, Instant};
4-
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
4+
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel};
55

66
pub fn manage_widgets_updates() -> (UnboundedSender<(usize, Vec<u64>)>, BoxedStream<Vec<usize>>) {
77
let (intervals_tx, intervals_rx) = unbounded_channel::<(usize, Vec<u64>)>();

src/formatting/template.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::formatter::{new_formatter, Formatter};
2-
use super::{parse, FormatError, Fragment, Values};
1+
use super::formatter::{Formatter, new_formatter};
2+
use super::{FormatError, Fragment, Values, parse};
33
use crate::config::SharedConfig;
44
use crate::errors::*;
55

src/formatting/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::borrow::Cow;
22
use std::time::Duration;
33

4+
use super::Metadata;
45
use super::formatter;
56
use super::unit::Unit;
6-
use super::Metadata;
77
use chrono::{DateTime, Utc};
88
use chrono_tz::Tz;
99

src/lib.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@ pub use serde_json;
2727
pub use tokio;
2828

2929
use std::borrow::Cow;
30-
use std::future::Future;
3130
use std::pin::Pin;
3231
use std::sync::{Arc, LazyLock};
3332
use std::time::Duration;
3433

35-
use futures::stream::{FuturesUnordered, StreamExt as _};
3634
use futures::Stream;
35+
use futures::stream::{FuturesUnordered, StreamExt as _};
3736
use tokio::process::Command;
38-
use tokio::sync::{mpsc, Notify};
37+
use tokio::sync::{Notify, mpsc};
3938

4039
use crate::blocks::{BlockAction, BlockError, CommonApi};
4140
use crate::click::{ClickHandler, MouseButton};
4241
use crate::config::{BlockConfigEntry, Config, SharedConfig};
4342
use crate::errors::*;
44-
use crate::formatting::value::Value;
4543
use crate::formatting::Format;
44+
use crate::formatting::value::Value;
4645
use crate::protocol::i3bar_block::I3BarBlock;
4746
use crate::protocol::i3bar_event::{self, I3BarEvent};
4847
use crate::signals::Signal;

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use i3status_rs::config::Config;
55
use i3status_rs::errors::*;
66
use i3status_rs::escape::Escaped;
77
use i3status_rs::widget::{State, Widget};
8-
use i3status_rs::{protocol, util, BarState};
8+
use i3status_rs::{BarState, protocol, util};
99

1010
#[derive(Debug, thiserror::Error)]
1111
enum ErrorMaybeInBlock {

src/netlink.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use neli::attr::Attribute as _;
22
use neli::consts::{nl::*, rtnl::*, socket::*};
33
use neli::nl::{NlPayload, Nlmsghdr};
44
use neli::rtnl::{Ifaddrmsg, Ifinfomsg, Rtmsg};
5-
use neli::socket::{tokio::NlSocket, NlSocketHandle};
5+
use neli::socket::{NlSocketHandle, tokio::NlSocket};
66
use neli::types::RtBuffer;
77

88
use regex::Regex;

src/protocol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ pub mod i3bar_event;
33

44
use std::borrow::Borrow;
55

6+
use crate::RenderedBlock;
67
use crate::config::SharedConfig;
78
use crate::themes::color::Color;
89
use crate::themes::separator::Separator;
9-
use crate::RenderedBlock;
1010

1111
use i3bar_block::I3BarBlock;
1212

0 commit comments

Comments
 (0)