Fix clippy::field_reassign_with_defaults instead of ignoring it

Fixes: fc2d7fc4 ("ci: Add some more ignored lints to the clippy configuration")
This commit is contained in:
Marijn Suijten 2021-01-01 20:35:43 +01:00
parent 14f7707b51
commit 7ed20090d1
13 changed files with 18 additions and 33 deletions

View file

@ -352,13 +352,13 @@ clippy:
echo "Running clippy on $crate with $FEATURES"
cargo clippy --locked --color=always --manifest-path $crate/Cargo.toml $FEATURES --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::field_reassign_with_default -D warnings
cargo clippy --locked --color=always --manifest-path $crate/Cargo.toml $FEATURES --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -D warnings
fi
done
# And also run over all the examples/tutorials
- |
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::field_reassign_with_default -D warnings
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::field_reassign_with_default -D warnings
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -D warnings
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -D warnings
deny:
extends: .img-stable

View file

@ -92,8 +92,7 @@ mod tests {
buffer.set_flags(BufferFlags::LIVE | BufferFlags::DISCONT);
}
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&buffer, pretty_config);
assert_eq!(

View file

@ -94,8 +94,7 @@ mod tests {
buffer_list.add(buffer);
}
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&buffer_list, pretty_config);
assert_eq!(

View file

@ -240,8 +240,7 @@ mod tests {
.field("array", &Array::new(&[&1, &2]))
.build();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&caps, pretty_config);
assert_eq!(
@ -272,8 +271,7 @@ mod tests {
.features(&["foo:bar", "foo:baz"])
.build();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&caps, pretty_config);
assert_eq!(
@ -307,8 +305,7 @@ mod tests {
.any_features()
.build();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&caps, pretty_config.clone());
assert_eq!(

View file

@ -55,8 +55,7 @@ mod tests {
// Some
let clocktime = ClockTime::from_nseconds(42_123_456_789);
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&clocktime, pretty_config.clone());
assert_eq!(Ok("Some(42123456789)".to_owned()), res);

View file

@ -176,8 +176,7 @@ mod tests {
fn test_serialize() {
crate::init().unwrap();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let datetime = DateTime::new(2f32, 2018, 5, 28, 16, 6, 42.123_456f64).unwrap();
let res = ron::ser::to_string_pretty(&datetime, pretty_config.clone());

View file

@ -67,8 +67,7 @@ mod tests {
fn test_serialize() {
crate::init().unwrap();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let value = GenericFormattedValue::Undefined(Undefined::from(42));
let res = ron::ser::to_string_pretty(&value, pretty_config.clone());

View file

@ -90,8 +90,7 @@ mod tests {
fn test_serialize() {
crate::init().unwrap();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let sample = {
let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]);

View file

@ -131,8 +131,7 @@ mod tests {
segment.set_position(GenericFormattedValue::Time(ClockTime::from_nseconds(256)));
segment.set_duration(GenericFormattedValue::Time(ClockTime::none()));
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&segment, pretty_config);
assert_eq!(

View file

@ -186,8 +186,7 @@ mod tests {
.field("array", &Array::new(&[&1, &2]))
.build();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&s, pretty_config);
assert_eq!(

View file

@ -361,8 +361,7 @@ mod tests {
tags.add::<Image>(&sample, TagMergeMode::Append); // Sample
}
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&tags, pretty_config);
assert_eq!(

View file

@ -191,8 +191,7 @@ mod tests {
toc.append_entry(toc_edition);
}
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&toc, pretty_config);
assert_eq!(

View file

@ -313,8 +313,7 @@ mod tests {
fn test_serialize_simple() {
crate::init().unwrap();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
// Fraction
let fraction = Fraction::new(1, 3);
@ -356,8 +355,7 @@ mod tests {
fn test_serialize_collections() {
crate::init().unwrap();
let mut pretty_config = ron::ser::PrettyConfig::default();
pretty_config.new_line = "".to_string();
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
// Array
let value_13 = Fraction::new(1, 3);