Skip to content

Commit 876339d

Browse files
committed
rust - satiate clippy
1 parent 44b080e commit 876339d

File tree

60 files changed

+53
-5348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+53
-5348
lines changed

examples/rust/ex1-volume/src/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ fn example_1(options: opt::Opt) -> libceed::Result<()> {
4646
quiet,
4747
gallery,
4848
} = options;
49-
assert!(dim >= 1 && dim <= 3);
49+
assert!((1..=3).contains(&dim));
5050
assert!(mesh_degree >= 1);
5151
assert!(solution_degree >= 1);
5252
assert!(num_qpts >= 1);
5353
let ncomp_x = dim;
54-
let problem_size: i64;
55-
if problem_size_requested < 0 {
56-
problem_size = if test { 8 * 16 } else { 256 * 1024 };
54+
let problem_size: i64 = if problem_size_requested < 0 {
55+
if test {
56+
8 * 16
57+
} else {
58+
256 * 1024
59+
}
5760
} else {
58-
problem_size = problem_size_requested;
59-
}
61+
problem_size_requested
62+
};
6063

6164
// Summary output
6265
if !quiet {
@@ -102,7 +105,7 @@ fn example_1(options: opt::Opt) -> libceed::Result<()> {
102105
if dim > 2 {
103106
print!(", nz = {}", num_xyz[2]);
104107
}
105-
print!("\n");
108+
println!();
106109
}
107110

108111
// Build ElemRestriction objects describing the mesh and solution discrete

examples/rust/ex2-surface/src/main.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,20 @@ fn example_2(options: opt::Opt) -> libceed::Result<()> {
4747
quiet,
4848
gallery,
4949
} = options;
50-
assert!(dim >= 1 && dim <= 3);
50+
assert!((0..=3).contains(&dim));
5151
assert!(mesh_degree >= 1);
5252
assert!(solution_degree >= 1);
5353
assert!(num_qpts >= 1);
5454
let ncomp_x = dim;
55-
let problem_size: i64;
56-
if problem_size_requested < 0 {
57-
problem_size = if test {
55+
let problem_size: i64 = if problem_size_requested < 0 {
56+
if test {
5857
16 * 16 * (dim * dim) as i64
5958
} else {
6059
256 * 1024
61-
};
60+
}
6261
} else {
63-
problem_size = problem_size_requested;
64-
}
62+
problem_size_requested
63+
};
6564

6665
// Summary output
6766
if !quiet {
@@ -107,7 +106,7 @@ fn example_2(options: opt::Opt) -> libceed::Result<()> {
107106
if dim > 2 {
108107
print!(", nz = {}", num_xyz[2]);
109108
}
110-
print!("\n");
109+
println!();
111110
}
112111

113112
// Build ElemRestriction objects describing the mesh and solution discrete

examples/rust/ex3-vector-volume/src/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ fn example_3(options: opt::Opt) -> libceed::Result<()> {
4747
quiet,
4848
gallery,
4949
} = options;
50-
assert!(dim >= 1 && dim <= 3);
50+
assert!((0..=3).contains(&dim));
5151
assert!(mesh_degree >= 1);
5252
assert!(solution_degree >= 1);
5353
assert!(num_qpts >= 1);
5454
let ncomp_x = dim;
55-
let problem_size: i64;
56-
if problem_size_requested < 0 {
57-
problem_size = if test { 8 * 16 } else { 256 * 1024 };
55+
let problem_size: i64 = if problem_size_requested < 0 {
56+
if test {
57+
8 * 16
58+
} else {
59+
256 * 1024
60+
}
5861
} else {
59-
problem_size = problem_size_requested;
60-
}
62+
problem_size_requested
63+
};
6164
let ncomp_u = 3;
6265

6366
// Summary output
@@ -104,7 +107,7 @@ fn example_3(options: opt::Opt) -> libceed::Result<()> {
104107
if dim > 2 {
105108
print!(", nz = {}", num_xyz[2]);
106109
}
107-
print!("\n");
110+
println!();
108111
}
109112

110113
// Build ElemRestriction objects describing the mesh and solution discrete

examples/rust/ex4-vector-surface/src/main.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,20 @@ fn example_4(options: opt::Opt) -> libceed::Result<()> {
4848
quiet,
4949
gallery,
5050
} = options;
51-
assert!(dim >= 1 && dim <= 3);
51+
assert!((0..=3).contains(&dim));
5252
assert!(mesh_degree >= 1);
5353
assert!(solution_degree >= 1);
5454
assert!(num_qpts >= 1);
5555
let ncomp_x = dim;
56-
let problem_size: i64;
57-
if problem_size_requested < 0 {
58-
problem_size = if test {
56+
let problem_size: i64 = if problem_size_requested < 0 {
57+
if test {
5958
16 * 16 * (dim * dim) as i64
6059
} else {
6160
256 * 1024
62-
};
61+
}
6362
} else {
64-
problem_size = problem_size_requested;
65-
}
63+
problem_size_requested
64+
};
6665
let ncomp_u = 3;
6766

6867
// Summary output
@@ -109,7 +108,7 @@ fn example_4(options: opt::Opt) -> libceed::Result<()> {
109108
if dim > 2 {
110109
print!(", nz = {}", num_xyz[2]);
111110
}
112-
print!("\n");
111+
println!();
113112
}
114113

115114
// Build ElemRestriction objects describing the mesh and solution discrete

examples/zig/.zig-cache/h/15f2301655d3c70b6a666f9cdf310275.txt

Lines changed: 0 additions & 88 deletions
This file was deleted.

examples/zig/.zig-cache/h/18e64a61c49521674b05bdd667a5adcd.txt

Whitespace-only changes.

examples/zig/.zig-cache/h/27ec2f6229ef74ecea7fabcbe8cab205.txt

Lines changed: 0 additions & 85 deletions
This file was deleted.

examples/zig/.zig-cache/h/2d5a1a170162485e07206475f0417a4d.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)