Skip to content

Commit b56e362

Browse files
authored
chore: add VS Code Dev Container + pin toolchain (#51)
* chore: add devcontainer configuration for Rust development * chore: format Cargo.toml files with `Even Better TOML` * chore: add rust-toolchain configuration for stable channel with rustfmt and clippy * chore: include custom container name * chore: add GitHub Actions extension to devcontainer
1 parent d3ce668 commit b56e362

4 files changed

Lines changed: 71 additions & 28 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Rust [minimal]",
3+
"runArgs": [
4+
"--name",
5+
"bourso-api-dev"
6+
],
7+
"image": "mcr.microsoft.com/devcontainers/rust:latest",
8+
"remoteUser": "vscode",
9+
"postCreateCommand": "rustup component add clippy rustfmt",
10+
"customizations": {
11+
"vscode": {
12+
"settings": {
13+
"editor.formatOnSave": true,
14+
"terminal.integrated.defaultProfile.linux": "zsh",
15+
"rust-analyzer.check.command": "clippy",
16+
"evenBetterToml.formatter.alignEntries": true,
17+
"[rust]": {
18+
"editor.defaultFormatter": "rust-lang.rust-analyzer"
19+
},
20+
"[toml]": {
21+
"editor.defaultFormatter": "tamasfe.even-better-toml"
22+
}
23+
},
24+
"extensions": [
25+
"rust-lang.rust-analyzer",
26+
"vadimcn.vscode-lldb",
27+
"tamasfe.even-better-toml",
28+
"fill-labs.dependi",
29+
"github.vscode-github-actions"
30+
]
31+
}
32+
},
33+
"features": {
34+
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
35+
"plugins": "git golang zsh-autosuggestions zsh-syntax-highlighting",
36+
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-syntax-highlighting",
37+
"username": "vscode"
38+
}
39+
}
40+
}

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
[package]
2-
name = "bourso-cli"
3-
version = "0.3.2"
4-
edition = "2021"
2+
name = "bourso-cli"
3+
version = "0.3.2"
4+
edition = "2021"
55
repository = "https://github.com/azerpas/bourso-api"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
bourso_api = { path = "./src/bourso_api" }
11-
tokio = { version = "1.33.0", features = ["full"] }
12-
anyhow = { version = "1.0.75" }
13-
clap = { version = "4.4.6" }
14-
rpassword = { version = "7.2.0" }
15-
directories = { version = "5.0.1" }
16-
serde = { version = "1.0.189", features = ["derive"] }
17-
serde_json = { version = "1.0.107" }
18-
log = { version = "0.4.20" }
19-
log4rs = { version = "1.3.0" }
20-
futures-util = "0.3.31"
10+
bourso_api = { path = "./src/bourso_api" }
11+
tokio = { version = "1.33.0", features = ["full"] }
12+
anyhow = { version = "1.0.75" }
13+
clap = { version = "4.4.6" }
14+
rpassword = { version = "7.2.0" }
15+
directories = { version = "5.0.1" }
16+
serde = { version = "1.0.189", features = ["derive"] }
17+
serde_json = { version = "1.0.107" }
18+
log = { version = "0.4.20" }
19+
log4rs = { version = "1.3.0" }
20+
futures-util = { version = "0.3.31"}
2121

2222
[lints.rust]
2323
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "stable"
3+
components = ["rustfmt", "clippy"]

src/bourso_api/Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[package]
2-
name = "bourso_api"
2+
name = "bourso_api"
33
version = "0.4.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
reqwest = { version = "0.12.12", features = ["multipart", "cookies"] }
10-
anyhow = { version = "1.0.75" }
11-
regex = { version = "1.10.2" }
12-
lazy_static = { version = "1.4.0" }
13-
clap = { version = "4.5.26", features = ["derive"] }
14-
serde = { version = "1.0.189", features = ["derive"] }
15-
serde_json = { version = "1.0.107" }
16-
reqwest_cookie_store = "0.8.0"
17-
cookie_store = "0.21.1"
18-
chrono = { version = "0.4.39" }
19-
log = { version = "0.4.20" }
20-
futures-util = "0.3.31"
21-
async-stream = "0.3.6"
9+
reqwest = { version = "0.12.12", features = ["multipart", "cookies"] }
10+
anyhow = { version = "1.0.75" }
11+
regex = { version = "1.10.2" }
12+
lazy_static = { version = "1.4.0" }
13+
clap = { version = "4.5.26", features = ["derive"] }
14+
serde = { version = "1.0.189", features = ["derive"] }
15+
serde_json = { version = "1.0.107" }
16+
reqwest_cookie_store = { version = "0.8.0" }
17+
cookie_store = { version = "0.21.1" }
18+
chrono = { version = "0.4.39" }
19+
log = { version = "0.4.20" }
20+
futures-util = { version = "0.3.31" }
21+
async-stream = { version = "0.3.6" }
2222

2323
[lints.rust]
2424
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }

0 commit comments

Comments
 (0)