Skip to content

Commit 0af3a7a

Browse files
committed
fix: replace let _ with explicit drop for Command output
Clippy was reporting a non-binding let on a type that has a destructor. Using explicit drop() makes the intention clear and resolves the lint.
1 parent 641ed4b commit 0af3a7a

File tree

5 files changed

+114
-4
lines changed

5 files changed

+114
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@ Thumbs.db
5151
target/
5252
Cargo.lock
5353

54+
# Meson build directory
55+
builddir/
56+
5457
# Coverage reports
5558
.coverage/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ cargo install --path .
9393
torrust-testing-infra
9494
```
9595

96+
#### Development Tasks
97+
98+
This project uses [Meson](https://mesonbuild.com/) as a task runner for common development commands:
99+
100+
```bash
101+
# Setup Meson (one-time setup)
102+
meson setup builddir
103+
104+
# Run comprehensive clippy linting
105+
meson compile -C builddir clippy
106+
```
107+
108+
**[📖 See full Meson setup guide →](docs/meson.md)**
109+
96110
#### Running E2E Tests
97111

98112
Use the E2E tests binary to run automated infrastructure tests:

docs/meson.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Meson Task Runner Setup
2+
3+
This project uses [Meson](https://mesonbuild.com/) as a task runner to wrap common development commands and make them easier to execute.
4+
5+
## Prerequisites
6+
7+
Make sure you have Meson installed:
8+
9+
```bash
10+
# On Ubuntu/Debian
11+
sudo apt install meson
12+
13+
# On other systems, check: https://mesonbuild.com/Getting-meson.html
14+
```
15+
16+
## Setup
17+
18+
1. Initialize the Meson build directory (only needed once):
19+
20+
```bash
21+
meson setup builddir
22+
```
23+
24+
This creates a `builddir/` directory with the Meson configuration.
25+
26+
## Available Commands
27+
28+
### Clippy Linter
29+
30+
Run the comprehensive Clippy linter with all lint categories enabled:
31+
32+
```bash
33+
meson compile -C builddir clippy
34+
```
35+
36+
This is equivalent to running:
37+
38+
```bash
39+
CARGO_INCREMENTAL=0 cargo clippy --no-deps --tests --benches --examples --workspace --all-targets --all-features -- -D clippy::correctness -D clippy::suspicious -D clippy::complexity -D clippy::perf -D clippy::style -D clippy::pedantic
40+
```
41+
42+
## Why Use Meson?
43+
44+
- **Shorter commands**: Instead of typing long cargo commands, use simple meson targets
45+
- **Consistent environment**: Commands run with the same environment variables every time
46+
- **Easy to extend**: Add new targets to `meson.build` as needed
47+
- **IDE integration**: Many IDEs can integrate with Meson build systems
48+
49+
## Adding More Commands
50+
51+
To add more commands, edit the `meson.build` file and add new `run_target()` definitions. After modifying the file, you may need to reconfigure:
52+
53+
```bash
54+
meson setup builddir --reconfigure
55+
```
56+
57+
## Directory Structure
58+
59+
```text
60+
project-root/
61+
├── meson.build # Meson configuration with task definitions
62+
├── builddir/ # Meson build directory (auto-generated)
63+
└── ... # Your project files
64+
```
65+
66+
The `builddir/` directory is automatically generated and can be safely deleted and recreated.

meson.build

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
project('torrust-testing-infra', 'rust',
2+
version : '0.1.0',
3+
default_options : ['warning_level=3'])
4+
5+
# Clippy linter with comprehensive checks
6+
run_target('clippy',
7+
command : [
8+
'env',
9+
'CARGO_INCREMENTAL=0',
10+
'cargo', 'clippy',
11+
'--no-deps',
12+
'--tests',
13+
'--benches',
14+
'--examples',
15+
'--workspace',
16+
'--all-targets',
17+
'--all-features',
18+
'--',
19+
'-D', 'clippy::correctness',
20+
'-D', 'clippy::suspicious',
21+
'-D', 'clippy::complexity',
22+
'-D', 'clippy::perf',
23+
'-D', 'clippy::style',
24+
'-D', 'clippy::pedantic'
25+
])

src/bin/e2e_tests.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ impl Drop for TestEnvironment {
364364
if !self.keep_env {
365365
// Try basic cleanup in case async cleanup failed
366366
let tofu_dir = self.project_root.join("config/tofu/lxd");
367-
drop(Command::new("tofu")
368-
.args(["destroy", "-auto-approve"])
369-
.current_dir(&tofu_dir)
370-
.output());
367+
drop(
368+
Command::new("tofu")
369+
.args(["destroy", "-auto-approve"])
370+
.current_dir(&tofu_dir)
371+
.output(),
372+
);
371373
}
372374
}
373375
}

0 commit comments

Comments
 (0)