Skip to content

Commit 3dffd83

Browse files
committed
Merge #300: Remove unused dependencies
823537e fix: [#234] remove unused dependencies (Jose Celano) a933a69 ci: run tests for workspace packages (Jose Celano) feaa173 fix: test for configuration (Jose Celano) Pull request description: Remove unused dependencies detected by this command: ``` cargo +nightly udeps --all-targets ``` Some of them were false positives because they were used for testing. It was fixed by moving them from `[dependencies]` to `[dev-dependencies]` section in the `Cargo.toml` file. Top commit has no ACKs. Tree-SHA512: 24a5eafa97f5976f6990361ddda835a138807d9032d04958113f5d916b6b52bb3fa5bec47b4634e5a0f72f9438ca23a72060f4d0fbc7eea8c5e2e5ab22860ddd
2 parents e1e731a + 823537e commit 3dffd83

File tree

7 files changed

+18
-65
lines changed

7 files changed

+18
-65
lines changed

.github/workflows/test_build_release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636
run: cargo clippy --all-targets -- -D clippy::pedantic
3737
- name: Test Documentation
3838
run: cargo test --doc
39+
- name: Run Tests
40+
run: cargo test --workspace
3941
- uses: taiki-e/install-action@cargo-llvm-cov
4042
- uses: taiki-e/install-action@nextest
41-
- name: Run Tests
43+
- name: Show coverage
4244
run: cargo llvm-cov nextest
4345

4446
build:

Cargo.lock

Lines changed: 3 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ serde = { version = "1.0", features = ["derive"] }
1818
serde_bencode = "^0.2"
1919
serde_json = "1.0"
2020
serde_with = "2.0"
21-
hex = "0.4"
2221
percent-encoding = "2.2"
2322
binascii = "0.1"
2423
lazy_static = "1.4"
2524
openssl = { version = "0.10", features = ["vendored"] }
2625
config = "0.13"
27-
toml = "0.7"
2826
log = { version = "0.4", features = ["release_max_level_info"] }
2927
fern = "0.6"
3028
chrono = "0.4"

packages/configuration/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ log = { version = "0.4", features = ["release_max_level_info"] }
1515
thiserror = "1.0"
1616
torrust-tracker-primitives = { version = "3.0.0-alpha.1", path = "../primitives" }
1717
torrust-tracker-located-error = { version = "3.0.0-alpha.1", path = "../located-error" }
18+
19+
[dev-dependencies]
1820
uuid = { version = "1", features = ["v4"] }

packages/configuration/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,14 @@ impl Configuration {
557557
/// permission to read it. Will also return `Err` if the configuration is
558558
/// not valid or cannot be encoded to TOML.
559559
pub fn save_to_file(&self, path: &str) -> Result<(), Error> {
560-
let toml_string = toml::to_string(self).expect("Could not encode TOML value");
561-
fs::write(path, toml_string).expect("Could not write to file!");
560+
fs::write(path, self.to_toml()).expect("Could not write to file!");
562561
Ok(())
563562
}
563+
564+
/// Encodes the configuration to TOML.
565+
fn to_toml(&self) -> String {
566+
toml::to_string(self).expect("Could not encode TOML value")
567+
}
564568
}
565569

566570
#[cfg(test)]
@@ -575,11 +579,11 @@ mod tests {
575579
db_path = "./storage/database/data.db"
576580
announce_interval = 120
577581
min_announce_interval = 120
578-
max_peer_timeout = 900
579582
on_reverse_proxy = false
580583
external_ip = "0.0.0.0"
581584
tracker_usage_statistics = true
582585
persistent_torrent_completed_stat = false
586+
max_peer_timeout = 900
583587
inactive_peer_cleanup_interval = 600
584588
remove_peerless_torrents = true
585589

packages/located-error/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ edition.workspace = true
88

99
[dependencies]
1010
log = { version = "0.4", features = ["release_max_level_info"] }
11+
12+
[dev-dependencies]
1113
thiserror = "1.0"
14+

packages/test-helpers/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ authors.workspace = true
77
edition.workspace = true
88

99
[dependencies]
10-
tokio = { version = "1", features = ["rt-multi-thread", "net", "sync", "macros", "signal"] }
1110
lazy_static = "1.4"
1211
rand = "0.8.5"
1312
torrust-tracker-configuration = { version = "3.0.0-alpha.1", path = "../configuration"}

0 commit comments

Comments
 (0)