Skip to content

Commit 36fac93

Browse files
committed
added clippy lints
1 parent 47a868f commit 36fac93

File tree

18 files changed

+69
-17
lines changed

18 files changed

+69
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ cargo run -p tmc-langs-cli help
3838

3939
## Development
4040

41-
Format using `cargo fmt`, use `cargo clippy` for linting.
41+
Format using `cargo fmt`, use `cargo clippy` for linting. All crates should have the clippy lints `print_stdout` and `print_stderr` set to deny. The CLI has one function where writing to stdout is allowed.
4242

4343
If using vscode and rust-analyzer, be sure to turn on the setting `loadOutDirsFromCheck` to avoid a spurious unresolved import error from `isolang`.
4444

plugins/csharp/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! TMC language plugin for C#.
24
35
mod cs_test_result;

plugins/java/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! Java plugins for ant and maven
24
35
mod ant_plugin;

plugins/make/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! TMC plugin for make.
24
35
mod check_log;

plugins/notests/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr, clippy::unwrap_used)]
2+
13
//! Language plugin for no_tests exercises.
24
35
mod plugin;

plugins/python3/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! Implementation of LanguagePlugin for Python 3.
24
35
mod error;

plugins/r/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! Language plugin for the R language
24
35
mod error;

tmc-client/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! Used to communicate with the TMC server. See the TmcClient struct for more details.
24
//!
35
//! ```rust,no_run

tmc-client/src/tmc_client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl TmcClient {
248248
// repeat until out of exercises
249249
loop {
250250
// acquiring mutex
251-
let mut exercises = exercises.lock().unwrap(); // the threads should never panic
251+
let mut exercises = exercises.lock().expect("the threads should never panic");
252252
let (exercise_id, target) = if let Some((id, path)) = exercises.pop() {
253253
(id, path)
254254
} else {
@@ -319,8 +319,7 @@ impl TmcClient {
319319
let mut successful = vec![];
320320
let mut failed = vec![];
321321
for handle in handles {
322-
// the threads should never panic
323-
match handle.join().unwrap() {
322+
match handle.join().expect("the threads should never panic") {
324323
Ok(s) => successful.extend(s),
325324
Err((s, f)) => {
326325
successful.extend(s);

tmc-langs-cli/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
#![deny(clippy::print_stdout, clippy::print_stderr)]
2+
13
//! CLI client for TMC
24
35
mod app;
4-
mod config;
56
mod error;
67
mod output;
78

8-
use self::config::ProjectsConfig;
9-
use self::config::{CourseConfig, Credentials, Exercise, TmcConfig};
109
use self::error::{DownloadsFailedError, InvalidTokenError, SandboxTestError};
1110
use self::output::{
1211
CombinedCourseData, Data, DownloadOrUpdateCourseExercise,
@@ -1568,6 +1567,7 @@ fn print_output(output: &Output, pretty: bool) -> Result<PrintToken> {
15681567
print_output_with_file(output, pretty, None)
15691568
}
15701569

1570+
#[allow(clippy::clippy::print_stdout)] // this is the only function that should output to stdout/stderr across tmc-langs
15711571
fn print_output_with_file(
15721572
output: &Output,
15731573
pretty: bool,

0 commit comments

Comments
 (0)