Skip to content

Commit

Permalink
Bump edition to 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
bim9262 committed Feb 21, 2025
1 parent 2fac1a0 commit 5e5a801
Show file tree
Hide file tree
Showing 35 changed files with 65 additions and 65 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ repos:
language: system
types: [rust]
args: ["--"]
require_serial: true
- id: cargo-clippy
name: cargo clippy
description: Run cargo clippy
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ authors = [
"Kai Greshake <development@kai-greshake.de>",
"Contributors on GitHub (https://github.com/greshake/i3status-rust/graphs/contributors)",
]
edition = "2021"
edition = "2024"

[workspace]
members = [".", "xtask"]
resolver = "2"
resolver = "3"

[features]
default = ["pulseaudio"]
Expand Down
2 changes: 1 addition & 1 deletion src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mod prelude;
use futures::future::FutureExt;
use futures::stream::FuturesUnordered;
use serde::de::{self, Deserialize};
use tokio::sync::{mpsc, Notify};
use tokio::sync::{Notify, mpsc};

use std::borrow::Cow;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/battery/upower.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use tokio::try_join;
use zbus::fdo::{PropertiesChangedStream, PropertiesProxy};
use zbus::{zvariant, Connection};
use zbus::{Connection, zvariant};
use zvariant::ObjectPath;

use super::{BatteryDevice, BatteryInfo, BatteryStatus, DeviceName};
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
_ => {
return Err(Error::new(
"Currently only one calendar source is supported",
))
));
}
};

Expand Down Expand Up @@ -344,15 +344,15 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
_ => {
return Err(Error::new(
"Authorization failed. Check your configurations",
))
));
}
}
}
e => {
return Err(Error {
message: None,
cause: Some(Arc::new(e)),
})
});
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/calendar/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use oauth2::{
PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, RefreshToken, Scope, StandardTokenResponse,
TokenResponse, TokenUrl,
};
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
use reqwest::Url;
use reqwest::header::{AUTHORIZATION, HeaderMap, HeaderValue};
use std::path::{Path, PathBuf};
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader};
Expand Down
7 changes: 3 additions & 4 deletions src/blocks/calendar/caldav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ use std::{str::FromStr, time::Duration, vec};
use chrono::{DateTime, Local, Utc};
use icalendar::{Component, EventLike};
use reqwest::{
self,
header::{HeaderMap, HeaderValue, CONTENT_TYPE},
ClientBuilder, Method, Url,
self, ClientBuilder, Method, Url,
header::{CONTENT_TYPE, HeaderMap, HeaderValue},
};
use serde::Deserialize;

use super::{
auth::{Auth, Authorize},
CalendarError,
auth::{Auth, Authorize},
};

#[derive(Clone, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/keyboard_layout/xkb_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use super::*;
use x11rb_async::{
connection::{Connection as _, RequestConnection as _},
protocol::{
Event,
xkb::{
self, ConnectionExt as _, EventType, MapPart, NameDetail, SelectEventsAux,
UseExtensionReply, ID,
self, ConnectionExt as _, EventType, ID, MapPart, NameDetail, SelectEventsAux,
UseExtensionReply,
},
xproto::ConnectionExt as _,
Event,
},
rust_connection::RustConnection,
};
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
use std::cmp::min;
use std::str::FromStr;
use tokio::fs::{read_dir, File};
use tokio::fs::{File, read_dir};
use tokio::io::{AsyncBufReadExt, BufReader};

use super::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use tokio::sync::mpsc::UnboundedReceiver;

use super::{prelude::*, BlockAction};
use super::{BlockAction, prelude::*};
use crate::subprocess::spawn_shell;

#[derive(Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/packages/apt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::process::Stdio;

use tokio::fs::{create_dir_all, File};
use tokio::fs::{File, create_dir_all};
use tokio::process::Command;

use super::*;
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pub use super::{BlockAction, CommonApi};

pub(crate) use crate::REQWEST_CLIENT;
pub(crate) use crate::REQWEST_CLIENT_IPV4;
pub use crate::click::MouseButton;
pub use crate::errors::*;
pub use crate::formatting::{config::Config as FormatConfig, value::Value, Values};
pub use crate::formatting::{Values, config::Config as FormatConfig, value::Value};
pub use crate::util::{default, new_dbus_connection, new_system_dbus_connection};
pub use crate::widget::{State, Widget};
pub use crate::wrappers::{Seconds, ShellString};
pub(crate) use crate::REQWEST_CLIENT;
pub(crate) use crate::REQWEST_CLIENT_IPV4;

pub use serde::Deserialize;

Expand Down
6 changes: 3 additions & 3 deletions src/blocks/privacy/v4l.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use debounced::{debounced, Debounced};
use debounced::{Debounced, debounced};
use inotify::{EventStream, Inotify, WatchDescriptor, WatchMask, Watches};
use tokio::fs::{read_dir, File};
use tokio::time::{interval, Interval};
use tokio::fs::{File, read_dir};
use tokio::time::{Interval, interval};

use std::path::PathBuf;

Expand Down
6 changes: 3 additions & 3 deletions src/blocks/sound/pulseaudio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use std::thread;
use libc::c_void;
use libpulse_binding::callbacks::ListResult;
use libpulse_binding::context::{
introspect::ServerInfo, introspect::SinkInfo, introspect::SourceInfo, subscribe::Facility,
subscribe::InterestMaskSet, Context, FlagSet, State as PulseState,
Context, FlagSet, State as PulseState, introspect::ServerInfo, introspect::SinkInfo,
introspect::SourceInfo, subscribe::Facility, subscribe::InterestMaskSet,
};
use libpulse_binding::mainloop::api::MainloopApi;
use libpulse_binding::mainloop::standard::{IterateResult, Mainloop};
use libpulse_binding::proplist::{properties, Proplist};
use libpulse_binding::proplist::{Proplist, properties};
use libpulse_binding::volume::{ChannelVolumes, Volume};
use tokio::sync::Notify;

Expand Down
2 changes: 1 addition & 1 deletion src/blocks/watson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! # TODO
//! - Extend functionality: start / stop watson using this block
use chrono::{offset::Local, DateTime};
use chrono::{DateTime, offset::Local};
use dirs::config_dir;
use inotify::{Inotify, WatchMask};
use serde::de::Deserializer;
Expand Down
8 changes: 5 additions & 3 deletions src/blocks/weather/met_no.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ impl WeatherProvider for Service<'_> {
}

if data.properties.timeseries.len() < forecast_hours {
return Err(Error::new(
format!("Unable to fetch the specified number of forecast_hours specified {}, only {} hours available", forecast_hours, data.properties.timeseries.len()),
))?;
return Err(Error::new(format!(
"Unable to fetch the specified number of forecast_hours specified {}, only {} hours available",
forecast_hours,
data.properties.timeseries.len()
)))?;
}

let data_agg: Vec<ForecastAggregateSegment> = data
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/weather/open_weather_map.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;
use chrono::{DateTime, Utc};
use serde::{de, Deserializer};
use serde::{Deserializer, de};

pub(super) const GEO_URL: &str = "https://api.openweathermap.org/geo/1.0";
pub(super) const CURRENT_URL: &str = "https://api.openweathermap.org/data/2.5/weather";
Expand Down
2 changes: 1 addition & 1 deletion src/click.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt;

use serde::de::{self, Deserializer, Visitor};
use serde::Deserialize;
use serde::de::{self, Deserializer, Visitor};

use crate::errors::{ErrorContext, Result};
use crate::protocol::i3bar_event::I3BarEvent;
Expand Down
4 changes: 2 additions & 2 deletions src/formatting/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{template::FormatTemplate, Format};
use super::{Format, template::FormatTemplate};
use crate::errors::*;
use serde::de::{MapAccess, Visitor};
use serde::{de, Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, de};
use std::fmt;
use std::str::FromStr;

Expand Down
12 changes: 6 additions & 6 deletions src/formatting/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use unicode_segmentation::UnicodeSegmentation;
use std::time::Duration;
use std::{borrow::Cow, fmt::Debug};

use super::FormatError;
use super::parse::Arg;
use super::value::ValueInner as Value;
use super::FormatError;
use crate::config::SharedConfig;
use crate::errors::*;

Expand All @@ -28,17 +28,17 @@ pub use bar::BarFormatter;
mod tally;
pub use tally::TallyFormatter;
mod datetime;
pub use datetime::{DatetimeFormatter, DEFAULT_DATETIME_FORMATTER};
pub use datetime::{DEFAULT_DATETIME_FORMATTER, DatetimeFormatter};
mod duration;
pub use duration::{DurationFormatter, DEFAULT_DURATION_FORMATTER};
pub use duration::{DEFAULT_DURATION_FORMATTER, DurationFormatter};
mod eng;
pub use eng::{EngFormatter, DEFAULT_NUMBER_FORMATTER};
pub use eng::{DEFAULT_NUMBER_FORMATTER, EngFormatter};
mod flag;
pub use flag::{FlagFormatter, DEFAULT_FLAG_FORMATTER};
pub use flag::{DEFAULT_FLAG_FORMATTER, FlagFormatter};
mod pango;
pub use pango::PangoStrFormatter;
mod str;
pub use str::{StrFormatter, DEFAULT_STRING_FORMATTER};
pub use str::{DEFAULT_STRING_FORMATTER, StrFormatter};

type PadWith = Cow<'static, str>;

Expand Down
2 changes: 1 addition & 1 deletion src/formatting/formatter/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const VERTICAL_BAR_CHARS: [char; 9] = [
impl Formatter for BarFormatter {
fn format(&self, val: &Value, _config: &SharedConfig) -> Result<String, FormatError> {
match val {
Value::Number { mut val, .. } => {
&Value::Number { mut val, .. } => {
val = (val / self.max_value).clamp(0., 1.);
if self.vertical {
let vert_char = VERTICAL_BAR_CHARS[(val * 8.) as usize];
Expand Down
2 changes: 1 addition & 1 deletion src/formatting/formatter/eng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl EngFormatter {
impl Formatter for EngFormatter {
fn format(&self, val: &Value, _config: &SharedConfig) -> Result<String, FormatError> {
match val {
Value::Number { mut val, mut unit } => {
&Value::Number { mut val, mut unit } => {
if !self.range.contains(&val) {
return Err(FormatError::NumberOutOfRange(val));
}
Expand Down
2 changes: 1 addition & 1 deletion src/formatting/parse.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::{any::TypeId, str::FromStr};

use nom::{
IResult, Parser,
branch::alt,
bytes::complete::{escaped_transform, tag, take_while, take_while1},
character::complete::{anychar, char},
combinator::{cut, eof, map, not, opt},
multi::{many0, separated_list0},
sequence::{preceded, separated_pair, terminated, tuple},
IResult, Parser,
};

use crate::errors::*;
Expand Down
6 changes: 1 addition & 5 deletions src/formatting/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ impl Prefix {
}

pub fn max(self, other: Self) -> Self {
if other > self {
other
} else {
self
}
if other > self { other } else { self }
}

pub fn apply(self, value: f64) -> f64 {
Expand Down
2 changes: 1 addition & 1 deletion src/formatting/scheduling.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::BoxedStream;
use futures::stream::StreamExt;
use std::time::{Duration, Instant};
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel};

pub fn manage_widgets_updates() -> (UnboundedSender<(usize, Vec<u64>)>, BoxedStream<Vec<usize>>) {
let (intervals_tx, intervals_rx) = unbounded_channel::<(usize, Vec<u64>)>();
Expand Down
4 changes: 2 additions & 2 deletions src/formatting/template.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::formatter::{new_formatter, Formatter};
use super::{parse, FormatError, Fragment, Values};
use super::formatter::{Formatter, new_formatter};
use super::{FormatError, Fragment, Values, parse};
use crate::config::SharedConfig;
use crate::errors::*;

Expand Down
2 changes: 1 addition & 1 deletion src/formatting/value.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::borrow::Cow;
use std::time::Duration;

use super::Metadata;
use super::formatter;
use super::unit::Unit;
use super::Metadata;
use chrono::{DateTime, Utc};
use chrono_tz::Tz;

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ use std::pin::Pin;
use std::sync::{Arc, LazyLock};
use std::time::Duration;

use futures::stream::{FuturesUnordered, StreamExt};
use futures::Stream;
use futures::stream::{FuturesUnordered, StreamExt};
use tokio::process::Command;
use tokio::sync::{mpsc, Notify};
use tokio::sync::{Notify, mpsc};

use crate::blocks::{BlockAction, BlockError, CommonApi};
use crate::click::{ClickHandler, MouseButton};
use crate::config::{BlockConfigEntry, Config, SharedConfig};
use crate::errors::*;
use crate::formatting::value::Value;
use crate::formatting::Format;
use crate::formatting::value::Value;
use crate::protocol::i3bar_block::I3BarBlock;
use crate::protocol::i3bar_event::{self, I3BarEvent};
use crate::signals::Signal;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use i3status_rs::config::Config;
use i3status_rs::errors::*;
use i3status_rs::escape::Escaped;
use i3status_rs::widget::{State, Widget};
use i3status_rs::{protocol, util, BarState};
use i3status_rs::{BarState, protocol, util};

#[derive(Debug, thiserror::Error)]
enum ErrorMaybeInBlock {
Expand Down
2 changes: 1 addition & 1 deletion src/netlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use neli::attr::Attribute;
use neli::consts::{nl::*, rtnl::*, socket::*};
use neli::nl::{NlPayload, Nlmsghdr};
use neli::rtnl::{Ifaddrmsg, Ifinfomsg, Rtmsg};
use neli::socket::{tokio::NlSocket, NlSocketHandle};
use neli::socket::{NlSocketHandle, tokio::NlSocket};
use neli::types::RtBuffer;

use regex::Regex;
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pub mod i3bar_event;

use std::borrow::Borrow;

use crate::RenderedBlock;
use crate::config::SharedConfig;
use crate::themes::color::Color;
use crate::themes::separator::Separator;
use crate::RenderedBlock;

use i3bar_block::I3BarBlock;

Expand Down
Loading

0 comments on commit 5e5a801

Please sign in to comment.