Skip to content

Commit

Permalink
A happy Clippy is a good Clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceejbot committed Dec 3, 2023
1 parent 08f34fd commit c6d0190
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions src/controller/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ mod tests {
use super::*;

#[test]
#[allow(clippy::approx_constant)]
fn ini_reader_trait_works() {
let conf = Ini::load_from_file("./tests/fixtures/all-types.ini")
.expect("ini fixture file should be readable");
Expand All @@ -648,20 +649,23 @@ mod tests {
assert_eq!(i_signed_int, -2);
let i_signed_empty: i32 = read_from_ini(-100, "iSignedEmpty", section);
assert_eq!(i_signed_empty, -100);

// This is why I need the lint allow above. Ha.
let f_float: f32 = read_from_ini(0.0f32, "fFloat", section);
assert_eq!(f_float, 2.71828);

let f_float_empty: f32 = read_from_ini(1.0f32, "fFloatEmpty", section);
assert_eq!(f_float_empty, 1.0);
let b_boolean_num_t: bool = read_from_ini(false, "bBooleanNumT", section);
assert_eq!(b_boolean_num_t, true);
assert!(b_boolean_num_t);
let b_boolean_string_t: bool = read_from_ini(false, "bBooleanStringT", section);
assert_eq!(b_boolean_string_t, true);
assert!(b_boolean_string_t);
let b_boolean_num_f: bool = read_from_ini(true, "bBooleanNumF", section);
assert_eq!(b_boolean_num_f, false);
assert!(!b_boolean_num_f);
let b_boolean_string_f: bool = read_from_ini(true, "bBooleanStringF", section);
assert_eq!(b_boolean_string_f, false);
assert!(!b_boolean_string_f);
let b_boolean_empty: bool = read_from_ini(true, "bBooleanEmpty", section);
assert_eq!(b_boolean_empty, true);
assert!(b_boolean_empty);
let s_string: String = read_from_ini("default".to_string(), "sString", section);
assert_eq!(s_string.as_str(), "String with spaces");
let s_string_empty: String = read_from_ini("default".to_string(), "sStringEmpty", section);
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Layouts: two schema versions and associated machinery.
#![allow(non_snake_case, non_camel_case_types)]

pub mod layout_v1;
pub mod layout_v2;
pub mod shared;
Expand Down Expand Up @@ -226,11 +224,13 @@ use crate::plugin::{resolutionHeight, resolutionWidth};
// mocked screen resolution numbers, because these functions are provided by
// C++ and require imgui etc.
#[cfg(test)]
#[allow(non_snake_case)]
fn resolutionWidth() -> f32 {
3440.0
}

#[cfg(test)]
#[allow(non_snake_case)]
fn resolutionHeight() -> f32 {
1440.0
}
Expand Down

0 comments on commit c6d0190

Please sign in to comment.