lint: fix clippy::suspicious_open_options of project.

This commit is contained in:
Krysztal112233 2024-03-23 16:49:35 +08:00
parent ef8c379370
commit d21dc125d0
No known key found for this signature in database
GPG key ID: 331615739A596A02
4 changed files with 5 additions and 2 deletions

View file

@ -1,2 +1,2 @@
msrv = "1.70.0"
cognitive-complexity-threshold = 10
cognitive-complexity-threshold = 24

View file

@ -247,11 +247,11 @@ pub struct Output {
}
impl Output {
#[allow(clippy::suspicious_open_options)]
fn new(name: Option<&str>) -> UResult<Self> {
let file = if let Some(name) = name {
// This is different from `File::create()` because we don't truncate the output yet.
// This allows using the output file as an input file.
#[allow(clippy::suspicious_open_options)]
let file = OpenOptions::new()
.write(true)
.create(true)

View file

@ -445,6 +445,7 @@ macro_rules! compare_with_gnu {
}
#[test]
#[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign
fn test_env_with_gnu_reference_parsing_errors() {
let ts = TestScenario::new(util_name!());

View file

@ -208,6 +208,7 @@ mod tests {
}
#[test]
#[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign
fn test_random_string_generate_with_delimiter_should_end_with_delimiter() {
let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, true, 1);
assert_eq!(1, random_string.len());
@ -251,6 +252,7 @@ mod tests {
}
#[test]
#[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign
fn test_random_string_generate_with_delimiter_should_not_end_with_delimiter() {
let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 0, false, 1);
assert_eq!(1, random_string.len());