Skip to content

Commit 91de33d

Browse files
committed
ptest: Some simple cleanups from clippy
Run the clippy Rust linter, and apply the simple cleanups it suggests. Signed-off-by: David Brown <david.brown@linaro.org>
1 parent 5b7ed6a commit 91de33d

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

ptest/src/main.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn main() -> Result<()> {
4343
let ncpus = num_cpus::get();
4444
let limiter = Arc::new(Semaphore::new(ncpus as isize));
4545

46-
let matrix = Matrix::from_yaml(&workflow)?;
46+
let matrix = Matrix::from_yaml(&workflow);
4747

4848
let mut children = vec![];
4949
let state = State::new(matrix.envs.len());
@@ -71,7 +71,7 @@ fn main() -> Result<()> {
7171
child.join().unwrap();
7272
}
7373

74-
println!("");
74+
println!();
7575

7676
Ok(())
7777
}
@@ -97,7 +97,7 @@ impl State {
9797
Arc::new(Mutex::new(State {
9898
running: HashSet::new(),
9999
done: HashSet::new(),
100-
total: total,
100+
total,
101101
}))
102102
}
103103

@@ -174,7 +174,7 @@ struct FeatureSet {
174174
}
175175

176176
impl Matrix {
177-
fn from_yaml(yaml: &[Yaml]) -> Result<Matrix> {
177+
fn from_yaml(yaml: &[Yaml]) -> Matrix {
178178
let mut envs = vec![];
179179

180180
let mut all_tests = HashSet::new();
@@ -192,13 +192,7 @@ impl Matrix {
192192
}
193193
Some(e) => e,
194194
};
195-
let fset = match FeatureSet::decode(elt) {
196-
Ok(fset) => fset,
197-
Err(err) => {
198-
warn!("Skipping: {:?}", err);
199-
continue;
200-
}
201-
};
195+
let fset = FeatureSet::decode(elt);
202196

203197
if false {
204198
// Respect the groupings in the `.workflow.yml` file.
@@ -222,23 +216,23 @@ impl Matrix {
222216
}
223217
}
224218

225-
Ok(Matrix {
226-
envs: envs,
227-
})
219+
Matrix {
220+
envs,
221+
}
228222
}
229223
}
230224

231225
impl FeatureSet {
232-
fn decode(text: &str) -> Result<FeatureSet> {
226+
fn decode(text: &str) -> FeatureSet {
233227
// The github workflow is just a space separated set of values.
234228
let values: Vec<_> = text
235229
.split(',')
236230
.map(|s| s.to_string())
237231
.collect();
238-
Ok(FeatureSet {
232+
FeatureSet {
239233
env: "MULTI_FEATURES".to_string(),
240-
values: values,
241-
})
234+
values,
235+
}
242236
}
243237

244238
/// Run a test for this given feature set. Output is captured and will be returned if there is

0 commit comments

Comments
 (0)