Skip to content

Commit

Permalink
style: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerschtli committed Oct 20, 2024
1 parent f9846c7 commit f0bc3c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/features/network/data.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::feature::Renderable;

use super::RenderConfig;
use super::PLACEHOLDER_ESSID;
use super::PLACEHOLDER_IPV4;
use super::PLACEHOLDER_IPV6;
use super::RenderConfig;

#[derive(Debug)]
pub(super) struct Data {
Expand Down
43 changes: 18 additions & 25 deletions src/features/network/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::feature;
use crate::wrapper::process;

use super::Data;
use super::UpdateConfig;
use super::FEATURE_NAME;
use super::UpdateConfig;

enum IpAddress {
V4,
Expand All @@ -18,14 +18,10 @@ enum IpAddress {

impl fmt::Display for IpAddress {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"IPv{}",
match self {
IpAddress::V4 => 4,
IpAddress::V6 => 6,
}
)
write!(f, "IPv{}", match self {
IpAddress::V4 => 4,
IpAddress::V6 => 6,
})
}
}

Expand Down Expand Up @@ -74,22 +70,19 @@ fn essid() -> Option<String> {
}

fn ip_address(address_type: &IpAddress) -> Option<String> {
let command = process::Command::new(
"dig",
&[
// decrease time and tries because commands are executed synchronously
// TODO: make asychronous
"+time=3", // default: 5 seconds
"+tries=1", // default: 3
"@resolver1.opendns.com",
match address_type {
IpAddress::V4 => "A",
IpAddress::V6 => "AAAA",
},
"myip.opendns.com",
"+short",
],
);
let command = process::Command::new("dig", &[
// decrease time and tries because commands are executed synchronously
// TODO: make asychronous
"+time=3", // default: 5 seconds
"+tries=1", // default: 3
"@resolver1.opendns.com",
match address_type {
IpAddress::V4 => "A",
IpAddress::V6 => "AAAA",
},
"myip.opendns.com",
"+short",
]);

let output = command.output().wrap_error(
FEATURE_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/wrapper/dbus.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub(crate) use dbus::Path;
use dbus::ffidisp::BusType;
use dbus::ffidisp::Connection as DbusConnection;
use dbus::ffidisp::ConnectionItem;
pub(crate) use dbus::Path;

use crate::error::Result;
use crate::error::WrapErrorExt;
Expand Down

0 comments on commit f0bc3c7

Please sign in to comment.