Skip to content

Commit 1a10cc1

Browse files
committed
cargo fix + make clippy happy
1 parent 2deecd1 commit 1a10cc1

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

battlefield_rcon/src/bf4/ban_list.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use std::time::Duration;
22

3-
use ascii::IntoAsciiString;
4-
5-
use super::{RconEncoding, Eaid};
6-
3+
use super::Eaid;
74

85
#[derive(Clone, Debug)]
96
pub enum Ban {

battlefox/src/mapvote.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use matching::AltMatcher;
2525
use multimap::MultiMap;
2626
use rand::{RngCore, thread_rng};
2727
use std::cell::Cell;
28+
use std::fmt::Write;
2829
use std::time::Instant;
2930
use std::{cmp::min, hash::Hash};
3031
use std::{
@@ -141,7 +142,7 @@ impl Inner {
141142
// msg += "\t";
142143
for (mip, matcher) in chunk {
143144
// TODO: Add [NV] for vehicle_threshold as well
144-
msg += &format!("\t{}\t{}", matcher.number, mip.map.tab4_prefixlen_wvehicles(matcher.minlen, mip.vehicles.unwrap_or(true))); // TODO: trim last \t of last chunk item.
145+
write!(msg, "\t{}\t{}", matcher.number, mip.map.tab4_prefixlen_wvehicles(matcher.minlen, mip.vehicles.unwrap_or(true))).unwrap(); // TODO: trim last \t of last chunk item.
145146
}
146147
msg += "\n"; // TODO: trim last \n of last line.
147148
}

battlefox/src/mapvote/animate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn usize_of_rat(rat: &Rat) -> usize {
1616
warn!("{} is not an integer. Rounding towards zero and continuing..", rat);
1717
}
1818
let (sign, digits) = rat.to_integer().to_u64_digits();
19-
*digits.get(0).unwrap_or(&0) as usize
19+
*digits.first().unwrap_or(&0) as usize
2020
}
2121

2222
type Bars = HashMap<MapInPool, String>;
@@ -95,7 +95,7 @@ pub fn stv_anim_frames<'a>(alts_start: &[MapInPool], players: impl Iterator<Item
9595

9696
for (bars, hist_entry) in bars_seq.iter().zip_eq(x) {
9797
let mut lines = Vec::new();
98-
let frame = match hist_entry {
98+
match hist_entry {
9999
HistEntry::Starting { profile, assignment } => {
100100
lines.push("Everyones' votes:".to_string());
101101
let your_vote = assignment.get(player)
@@ -113,7 +113,7 @@ pub fn stv_anim_frames<'a>(alts_start: &[MapInPool], players: impl Iterator<Item
113113
let winner = elected.iter().next().unwrap();
114114
lines.push(format!("Mapvote winner: {}", winner.map.Pretty()));
115115
}
116-
};
116+
}
117117
player_frames.push(lines.join("\n"));
118118
}
119119

battlefox/src/players.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl Players {
213213
fn get_levenshtein(&self, map: &HashMap<Player, PlayerInServer>, target: &str) -> BTreeMap<usize, Player> {
214214
let target_lowercase = target.to_ascii_lowercase();
215215
map.iter().map(|(key, _value)| {
216-
(levenshtein(&target_lowercase, &key.name.to_ascii_lowercase().to_string()), key.to_owned())
216+
(levenshtein(&target_lowercase, key.name.to_ascii_lowercase().as_ref()), key.to_owned())
217217
}).collect()
218218
}
219219
}

battlefox/src/stv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,23 +509,23 @@ pub mod test {
509509
#[macro_export]
510510
macro_rules! ballot {
511511
[1, $($pref: expr),*] => {{
512-
crate::stv::Ballot {
512+
$crate::stv::Ballot {
513513
weight: num_rational::BigRational::one(),
514514
preferences: vec![
515515
$($pref),*
516516
],
517517
}
518518
}};
519519
[2, $($pref: expr),*] => {{
520-
crate::stv::Ballot {
520+
$crate::stv::Ballot {
521521
weight: Rat::one() + Rat::one(),
522522
preferences: vec![
523523
$($pref),*
524524
],
525525
}
526526
}};
527527
[0.5, $($pref: expr),*] => {{
528-
crate::stv::Ballot {
528+
$crate::stv::Ballot {
529529
weight: num_rational::BigRational::one() / (num_rational::BigRational::one() + num_rational::BigRational::one()),
530530
preferences: vec![
531531
$($pref),*

battlefox/src/teamkilling.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ impl TeamKilling {
163163
// We consider this kill a teamkill exactly when teamkill_history is Some(_).
164164
let teamkill_history = {
165165
let mut lock = self.inner.lock().unwrap();
166+
#[allow(clippy::significant_drop_in_scrutinee)] // this is a false positive...
166167
let debug = match lock.debug_count_suicides_as_tk.get(&killer) {
167168
Some(&DebugSatk::KillsAsTk) => true, // all kills are considered teamkills.
168169
Some(&DebugSatk::SuicidesAsTk) => killer == victim, // only suicides

battlefox_database/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn replace_into_muted_player(conn: &MysqlConnection, player: &BfoxMutedPlaye
6464
// println!("Count: {}", exists);
6565

6666
replace_into(bfox_muted_players)
67-
.values(&*player)
67+
.values(player)
6868
.execute(conn)?;
6969

7070
Ok(())

battlefox_database/src/models.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::extra_unused_lifetimes)] // warning stems from macro-generated stuff...
12
use chrono::NaiveDate;
23
use serde::Serialize;
34

battlefox_shared/src/models/mute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct MutedPlayer {
99
pub kicks: Option<u32>
1010
}
1111

12-
#[derive(Debug, PartialEq)]
12+
#[derive(Debug, PartialEq, Eq)]
1313
pub enum MuteType {
1414
Disabled = 0,
1515
Round = 1,

0 commit comments

Comments
 (0)