Skip to content

Commit 1d366fe

Browse files
committed
cargo clippy
1 parent 7730b5f commit 1d366fe

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/features/game_networking.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const FILTER_NAME_SAVE_SERVER: &str = "[GTA Tools] Block outbound traffic to Roc
1414
#[derive(Clone, Copy, Debug, Default, Display, EnumIter, PartialEq)]
1515
pub enum BlockedStatus {
1616
#[default]
17-
NotBlocked,
18-
ServerBlocked,
19-
ExeBlocked,
17+
Unblocked,
18+
Server,
19+
Executable,
2020
}
2121

2222
#[derive(Debug)]
@@ -29,11 +29,11 @@ impl Default for GameNetworking {
2929
let firewall = Firewall::default();
3030
Self {
3131
blocked: if firewall.is_blocked(FILTER_NAME_SAVE_SERVER).unwrap() {
32-
BlockedStatus::ServerBlocked
32+
BlockedStatus::Server
3333
} else if firewall.is_blocked(FILTER_NAME_EXE).unwrap() {
34-
BlockedStatus::ExeBlocked
34+
BlockedStatus::Executable
3535
} else {
36-
BlockedStatus::NotBlocked
36+
BlockedStatus::Unblocked
3737
},
3838
}
3939
}
@@ -52,13 +52,13 @@ impl GameNetworking {
5252
RuleDirection::Out,
5353
RuleProtocol::Any,
5454
)
55-
.inspect(|_| self.blocked = BlockedStatus::ExeBlocked)
55+
.inspect(|_| self.blocked = BlockedStatus::Executable)
5656
}
5757

5858
pub fn unblock_exe(&mut self, firewall: &Firewall) -> Result<()> {
5959
firewall
6060
.remove(FILTER_NAME_EXE)
61-
.inspect(|_| self.blocked = BlockedStatus::NotBlocked)
61+
.inspect(|_| self.blocked = BlockedStatus::Unblocked)
6262
}
6363

6464
pub fn block_save_server(&mut self, save_server_ip: &str, firewall: &Firewall) -> Result<()> {
@@ -69,13 +69,13 @@ impl GameNetworking {
6969
RuleDirection::Out,
7070
RuleProtocol::Any,
7171
)
72-
.inspect(|_| self.blocked = BlockedStatus::ServerBlocked)
72+
.inspect(|_| self.blocked = BlockedStatus::Server)
7373
}
7474

7575
pub fn unblock_save_server(&mut self, firewall: &Firewall) -> Result<()> {
7676
firewall
7777
.remove(FILTER_NAME_SAVE_SERVER)
78-
.inspect(|_| self.blocked = BlockedStatus::NotBlocked)
78+
.inspect(|_| self.blocked = BlockedStatus::Unblocked)
7979
}
8080

8181
pub fn ensure_block_exclusivity(
@@ -85,12 +85,12 @@ impl GameNetworking {
8585
) -> Result<()> {
8686
match block_method {
8787
BlockMethod::EntireGame => {
88-
if self.blocked == BlockedStatus::ServerBlocked {
88+
if self.blocked == BlockedStatus::Server {
8989
self.unblock_save_server(firewall)?;
9090
}
9191
}
9292
BlockMethod::SaveServer => {
93-
if self.blocked == BlockedStatus::ExeBlocked {
93+
if self.blocked == BlockedStatus::Executable {
9494
self.unblock_exe(firewall)?;
9595
}
9696
}

src/gui/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ impl App {
164164
};
165165
ui.add_space(1.0);
166166
ui.create_indicator_dot(match self.game_networking.blocked {
167-
BlockedStatus::ExeBlocked
167+
BlockedStatus::Executable
168168
if self.settings.block_method == BlockMethod::EntireGame =>
169169
{
170170
colours::RED
171171
}
172-
BlockedStatus::ServerBlocked
172+
BlockedStatus::Server
173173
if self.settings.block_method == BlockMethod::SaveServer =>
174174
{
175175
colours::RED

src/util/logging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ impl Logger {
4242

4343
fn log_to_file(&self, record: &log::Record) {
4444
let mut file = self.file.lock().unwrap();
45-
write!(
45+
writeln!(
4646
file,
47-
"[{}][{}] {}\n",
47+
"[{}][{}] {}",
4848
humantime::format_rfc3339_seconds(SystemTime::now()),
4949
record.level(),
5050
record.args()

0 commit comments

Comments
 (0)