Skip to content

Commit 5c38420

Browse files
committed
Merge #757: Update dependencies
80ce924 chore(deps): bump derive_more from 0.99.18 to 1.0.0 (Jose Celano) 02e29e9 chore(deps): update deps (Jose Celano) Pull request description: ```output cargo update Updating crates.io index Locking 74 packages to latest compatible versions Updating addr2line v0.24.1 -> v0.24.2 Updating anstream v0.6.15 -> v0.6.17 Updating anstyle v1.0.8 -> v1.0.9 Updating anstyle-parse v0.2.5 -> v0.2.6 Updating anstyle-query v1.1.1 -> v1.1.2 Updating anstyle-wincon v3.0.4 -> v3.0.6 Updating anyhow v1.0.89 -> v1.0.92 Updating async-compression v0.4.13 -> v0.4.17 Updating aws-lc-rs v1.9.0 -> v1.10.0 Updating aws-lc-sys v0.21.2 -> v0.22.0 Updating bindgen v0.69.4 -> v0.69.5 Updating bytemuck v1.18.0 -> v1.19.0 Updating bytes v1.7.2 -> v1.8.0 Updating cc v1.1.24 -> v1.1.31 Updating clap v4.5.19 -> v4.5.20 Updating clap_builder v4.5.19 -> v4.5.20 Updating colorchoice v1.0.2 -> v1.0.3 Updating encoding_rs v0.8.34 -> v0.8.35 Updating fdeflate v0.3.5 -> v0.3.6 Updating flume v0.11.0 -> v0.11.1 Updating futures v0.3.30 -> v0.3.31 Updating futures-channel v0.3.30 -> v0.3.31 Updating futures-core v0.3.30 -> v0.3.31 Updating futures-executor v0.3.30 -> v0.3.31 Updating futures-io v0.3.30 -> v0.3.31 Updating futures-macro v0.3.30 -> v0.3.31 Updating futures-sink v0.3.30 -> v0.3.31 Updating futures-task v0.3.30 -> v0.3.31 Updating futures-util v0.3.30 -> v0.3.31 Updating gimli v0.31.0 -> v0.31.1 Updating hyper v1.4.1 -> v1.5.0 Updating hyper-util v0.1.9 -> v0.1.10 Updating ipnet v2.10.0 -> v2.10.1 Updating js-sys v0.3.70 -> v0.3.72 Updating lettre v0.11.9 -> v0.11.10 Updating libc v0.2.159 -> v0.2.161 Updating libm v0.2.8 -> v0.2.11 Updating object v0.36.4 -> v0.36.5 Updating once_cell v1.20.1 -> v1.20.2 Updating openssl v0.10.66 -> v0.10.68 Updating openssl-sys v0.9.103 -> v0.9.104 Updating pest v2.7.13 -> v2.7.14 Updating pest_derive v2.7.13 -> v2.7.14 Updating pest_generator v2.7.13 -> v2.7.14 Updating pest_meta v2.7.13 -> v2.7.14 Updating pin-project v1.1.5 -> v1.1.7 Updating pin-project-internal v1.1.5 -> v1.1.7 Updating pin-project-lite v0.2.14 -> v0.2.15 Removing portable-atomic v1.9.0 Updating prettyplease v0.2.22 -> v0.2.25 Updating proc-macro2 v1.0.86 -> v1.0.89 Updating regex v1.11.0 -> v1.11.1 Updating reqwest v0.12.8 -> v0.12.9 Updating rustix v0.38.37 -> v0.38.38 Updating rustls v0.23.13 -> v0.23.16 Updating rustls-pki-types v1.9.0 -> v1.10.0 Updating rustversion v1.0.17 -> v1.0.18 Updating schannel v0.1.24 -> v0.1.26 Updating serde v1.0.210 -> v1.0.214 Updating serde_derive v1.0.210 -> v1.0.214 Updating serde_with v3.10.0 -> v3.11.0 Updating serde_with_macros v3.10.0 -> v3.11.0 Updating syn v2.0.79 -> v2.0.86 Updating thiserror v1.0.65 -> v1.0.66 Updating thiserror-impl v1.0.65 -> v1.0.66 Updating tokio v1.40.0 -> v1.41.0 Updating unicase v2.7.0 -> v2.8.0 Updating uuid v1.10.0 -> v1.11.0 Updating wasm-bindgen v0.2.93 -> v0.2.95 Updating wasm-bindgen-backend v0.2.93 -> v0.2.95 Updating wasm-bindgen-futures v0.4.43 -> v0.4.45 Updating wasm-bindgen-macro v0.2.93 -> v0.2.95 Updating wasm-bindgen-macro-support v0.2.93 -> v0.2.95 Updating wasm-bindgen-shared v0.2.93 -> v0.2.95 Updating web-sys v0.3.70 -> v0.3.72 ``` ACKs for top commit: josecelano: ACK 80ce924 Tree-SHA512: 962c679dc8099c09ae8c554d4b7c1dc5f05326a8594bd048fd065f0d556485c963c6ce28650afec16fefb1eefcaa8b88988a3f427a28955020a73b4a30b0dd67
2 parents c34b665 + 80ce924 commit 5c38420

File tree

9 files changed

+280
-303
lines changed

9 files changed

+280
-303
lines changed

Cargo.lock

+199-218
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ camino = { version = "1", features = ["serde"] }
4646
casbin = "2"
4747
chrono = { version = "0", default-features = false, features = ["clock"] }
4848
clap = { version = "4", features = ["derive", "env"] }
49-
derive_more = "0"
49+
derive_more = { version = "1", features = ["display", "error"] }
5050
email_address = "0"
5151
figment = { version = "0", features = ["env", "test", "toml"] }
5252
futures = "0"

src/config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub const LATEST_VERSION: &str = "2.0.0";
7373

7474
/// Info about the configuration specification.
7575
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Display, Clone)]
76-
#[display(fmt = "Metadata(app: {app}, purpose: {purpose}, schema_version: {schema_version})")]
76+
#[display("Metadata(app: {app}, purpose: {purpose}, schema_version: {schema_version})")]
7777
pub struct Metadata {
7878
/// The application this configuration is valid for.
7979
#[serde(default = "Metadata::default_app")]

src/console/commands/tracker_statistics_importer/app.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const NUMBER_OF_ARGUMENTS: usize = 0;
3838
#[derive(Debug, Display, PartialEq, Error)]
3939
#[allow(dead_code)]
4040
pub enum ImportError {
41-
#[display(fmt = "internal server error")]
41+
#[display("internal server error")]
4242
WrongNumberOfArgumentsError,
4343
}
4444

src/errors.rs

+52-54
Original file line numberDiff line numberDiff line change
@@ -14,167 +14,165 @@ pub type ServiceResult<V> = Result<V, ServiceError>;
1414
#[derive(Debug, Display, PartialEq, Eq, Error)]
1515
#[allow(dead_code)]
1616
pub enum ServiceError {
17-
#[display(fmt = "internal server error")]
17+
#[display("internal server error")]
1818
InternalServerError,
1919

20-
#[display(fmt = "This server is is closed for registration. Contact admin if this is unexpected")]
20+
#[display("This server is is closed for registration. Contact admin if this is unexpected")]
2121
ClosedForRegistration,
2222

23-
#[display(fmt = "Email is required")] //405j
23+
#[display("Email is required")] //405j
2424
EmailMissing,
25-
#[display(fmt = "Please enter a valid email address")] //405j
25+
#[display("Please enter a valid email address")] //405j
2626
EmailInvalid,
2727

28-
#[display(fmt = "The value you entered for URL is not a URL")] //405j
28+
#[display("The value you entered for URL is not a URL")] //405j
2929
NotAUrl,
3030

31-
#[display(fmt = "Invalid username/email or password")]
31+
#[display("Invalid username/email or password")]
3232
WrongPasswordOrUsername,
33-
#[display(fmt = "Invalid password")]
33+
#[display("Invalid password")]
3434
InvalidPassword,
35-
#[display(fmt = "Username not found")]
35+
#[display("Username not found")]
3636
UsernameNotFound,
37-
#[display(fmt = "User not found")]
37+
#[display("User not found")]
3838
UserNotFound,
3939

40-
#[display(fmt = "Account not found")]
40+
#[display("Account not found")]
4141
AccountNotFound,
4242

4343
/// when the value passed contains profanity
44-
#[display(fmt = "Can't allow profanity in usernames")]
44+
#[display("Can't allow profanity in usernames")]
4545
ProfanityError,
4646
/// when the value passed contains blacklisted words
4747
/// see [blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist)
48-
#[display(fmt = "Username contains blacklisted words")]
48+
#[display("Username contains blacklisted words")]
4949
BlacklistError,
5050
/// when the value passed contains characters not present
5151
/// in [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7)
5252
/// profile
53-
#[display(fmt = "username_case_mapped violation")]
53+
#[display("username_case_mapped violation")]
5454
UsernameCaseMappedError,
5555

56-
#[display(fmt = "Password too short")]
56+
#[display("Password too short")]
5757
PasswordTooShort,
58-
#[display(fmt = "Password too long")]
58+
#[display("Password too long")]
5959
PasswordTooLong,
60-
#[display(fmt = "Passwords don't match")]
60+
#[display("Passwords don't match")]
6161
PasswordsDontMatch,
6262

6363
/// when the a username is already taken
64-
#[display(fmt = "Username not available")]
64+
#[display("Username not available")]
6565
UsernameTaken,
6666

67-
#[display(fmt = "Invalid username. Usernames must consist of 1-20 alphanumeric characters, dashes, or underscore")]
67+
#[display("Invalid username. Usernames must consist of 1-20 alphanumeric characters, dashes, or underscore")]
6868
UsernameInvalid,
6969

7070
/// email is already taken
71-
#[display(fmt = "Email not available")]
71+
#[display("Email not available")]
7272
EmailTaken,
7373

74-
#[display(fmt = "Please verify your email before logging in")]
74+
#[display("Please verify your email before logging in")]
7575
EmailNotVerified,
7676

7777
/// when the a token name is already taken
7878
/// token not found
79-
#[display(fmt = "Token not found. Please sign in.")]
79+
#[display("Token not found. Please sign in.")]
8080
TokenNotFound,
8181

8282
/// token expired
83-
#[display(fmt = "Token expired. Please sign in again.")]
83+
#[display("Token expired. Please sign in again.")]
8484
TokenExpired,
8585

86-
#[display(fmt = "Token invalid.")]
86+
#[display("Token invalid.")]
8787
/// token invalid
8888
TokenInvalid,
8989

90-
#[display(fmt = "Uploaded torrent is not valid.")]
90+
#[display("Uploaded torrent is not valid.")]
9191
InvalidTorrentFile,
9292

93-
#[display(fmt = "Uploaded torrent has an invalid pieces key.")]
93+
#[display("Uploaded torrent has an invalid pieces key.")]
9494
InvalidTorrentPiecesLength,
9595

96-
#[display(fmt = "Only .torrent files can be uploaded.")]
96+
#[display("Only .torrent files can be uploaded.")]
9797
InvalidFileType,
9898

99-
#[display(fmt = "Torrent title is too short.")]
99+
#[display("Torrent title is too short.")]
100100
InvalidTorrentTitleLength,
101101

102-
#[display(fmt = "Some mandatory metadata fields are missing.")]
102+
#[display("Some mandatory metadata fields are missing.")]
103103
MissingMandatoryMetadataFields,
104104

105-
#[display(fmt = "Selected category does not exist.")]
105+
#[display("Selected category does not exist.")]
106106
InvalidCategory,
107107

108-
#[display(fmt = "Selected tag does not exist.")]
108+
#[display("Selected tag does not exist.")]
109109
InvalidTag,
110110

111-
#[display(fmt = "Unauthorized action.")]
111+
#[display("Unauthorized action.")]
112112
UnauthorizedAction,
113113

114-
#[display(
115-
fmt = "Unauthorized actions for guest users. Try logging in to check if you have permission to perform the action"
116-
)]
114+
#[display("Unauthorized actions for guest users. Try logging in to check if you have permission to perform the action")]
117115
UnauthorizedActionForGuests,
118116

119-
#[display(fmt = "This torrent already exists in our database.")]
117+
#[display("This torrent already exists in our database.")]
120118
InfoHashAlreadyExists,
121119

122-
#[display(fmt = "A torrent with the same canonical infohash already exists in our database.")]
120+
#[display("A torrent with the same canonical infohash already exists in our database.")]
123121
CanonicalInfoHashAlreadyExists,
124122

125-
#[display(fmt = "A torrent with the same original infohash already exists in our database.")]
123+
#[display("A torrent with the same original infohash already exists in our database.")]
126124
OriginalInfoHashAlreadyExists,
127125

128-
#[display(fmt = "This torrent title has already been used.")]
126+
#[display("This torrent title has already been used.")]
129127
TorrentTitleAlreadyExists,
130128

131-
#[display(fmt = "Could not whitelist torrent.")]
129+
#[display("Could not whitelist torrent.")]
132130
WhitelistingError,
133131

134-
#[display(fmt = "Failed to send verification email.")]
132+
#[display("Failed to send verification email.")]
135133
FailedToSendVerificationEmail,
136134

137-
#[display(fmt = "Category already exists.")]
135+
#[display("Category already exists.")]
138136
CategoryAlreadyExists,
139137

140-
#[display(fmt = "Category name cannot be empty.")]
138+
#[display("Category name cannot be empty.")]
141139
CategoryNameEmpty,
142140

143-
#[display(fmt = "Tag already exists.")]
141+
#[display("Tag already exists.")]
144142
TagAlreadyExists,
145143

146-
#[display(fmt = "Tag name cannot be empty.")]
144+
#[display("Tag name cannot be empty.")]
147145
TagNameEmpty,
148146

149-
#[display(fmt = "Torrent not found.")]
147+
#[display("Torrent not found.")]
150148
TorrentNotFound,
151149

152-
#[display(fmt = "Category not found.")]
150+
#[display("Category not found.")]
153151
CategoryNotFound,
154152

155-
#[display(fmt = "Tag not found.")]
153+
#[display("Tag not found.")]
156154
TagNotFound,
157155

158-
#[display(fmt = "Database error.")]
156+
#[display("Database error.")]
159157
DatabaseError,
160158

161-
#[display(fmt = "Authentication error, please sign in")]
159+
#[display("Authentication error, please sign in")]
162160
LoggedInUserNotFound,
163161

164162
// Begin tracker errors
165-
#[display(fmt = "Sorry, we have an error with our tracker connection.")]
163+
#[display("Sorry, we have an error with our tracker connection.")]
166164
TrackerOffline,
167165

168-
#[display(fmt = "Tracker response error. The operation could not be performed.")]
166+
#[display("Tracker response error. The operation could not be performed.")]
169167
TrackerResponseError,
170168

171-
#[display(fmt = "Tracker unknown response. Unexpected response from tracker. For example, if it can't be parsed.")]
169+
#[display("Tracker unknown response. Unexpected response from tracker. For example, if it can't be parsed.")]
172170
TrackerUnknownResponse,
173171

174-
#[display(fmt = "Torrent not found in tracker.")]
172+
#[display("Torrent not found in tracker.")]
175173
TorrentNotFoundInTracker,
176174

177-
#[display(fmt = "Invalid tracker API token.")]
175+
#[display("Invalid tracker API token.")]
178176
InvalidTrackerToken,
179177
// End tracker errors
180178
}

src/models/torrent.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ pub struct TorrentListing {
3232

3333
#[derive(Debug, Display, PartialEq, Eq, Error)]
3434
pub enum MetadataError {
35-
#[display(fmt = "Missing mandatory torrent title.")]
35+
#[display("Missing mandatory torrent title.")]
3636
MissingTorrentTitle,
3737

38-
#[display(fmt = "Torrent title is too short.")]
38+
#[display("Torrent title is too short.")]
3939
InvalidTorrentTitleLength,
4040
}
4141

src/tracker/service.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ use crate::models::user::UserId;
1515
#[derive(Debug, Display, PartialEq, Eq, Error)]
1616
#[allow(dead_code)]
1717
pub enum TrackerAPIError {
18-
#[display(fmt = "Error with tracker request: {error}.")]
18+
#[display("Error with tracker request: {error}.")]
1919
TrackerOffline { error: String },
2020

21-
#[display(fmt = "Invalid token for tracker API. Check the tracker token in settings.")]
21+
#[display("Invalid token for tracker API. Check the tracker token in settings.")]
2222
InvalidToken,
2323

24-
#[display(fmt = "Tracker returned an internal server error.")]
24+
#[display("Tracker returned an internal server error.")]
2525
InternalServerError,
2626

27-
#[display(fmt = "Tracker returned a not found error.")]
27+
#[display("Tracker returned a not found error.")]
2828
NotFound,
2929

30-
#[display(fmt = "Tracker returned an unexpected response status.")]
30+
#[display("Tracker returned an unexpected response status.")]
3131
UnexpectedResponseStatus,
3232

33-
#[display(fmt = "Could not save the newly generated user key into the database.")]
33+
#[display("Could not save the newly generated user key into the database.")]
3434
CannotSaveUserKey,
3535

36-
#[display(fmt = "Torrent not found.")]
36+
#[display("Torrent not found.")]
3737
TorrentNotFound,
3838

39-
#[display(fmt = "Expected body in tracker response, received empty body.")]
39+
#[display("Expected body in tracker response, received empty body.")]
4040
MissingResponseBody,
4141

42-
#[display(fmt = "Expected body in tracker response, received empty body.")]
42+
#[display("Expected body in tracker response, received empty body.")]
4343
FailedToParseTrackerResponse { body: String },
4444
}
4545

src/utils/parse_torrent.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ use bittorrent_primitives::info_hash::InfoHash;
44
use derive_more::{Display, Error};
55
use serde::{Deserialize, Serialize};
66
use serde_bencode::value::Value;
7-
use serde_bencode::{de, Error};
7+
use serde_bencode::{de, Error as SerdeError};
88
use sha1::{Digest, Sha1};
99

1010
use crate::models::torrent_file::Torrent;
1111

1212
#[derive(Debug, Display, PartialEq, Eq, Error)]
1313
pub enum DecodeTorrentFileError {
14-
#[display(fmt = "Torrent data could not be decoded from the bencoded format.")]
14+
#[display("Torrent data could not be decoded from the bencoded format.")]
1515
InvalidBencodeData,
1616

17-
#[display(fmt = "Torrent info dictionary key could not be decoded from the bencoded format.")]
17+
#[display("Torrent info dictionary key could not be decoded from the bencoded format.")]
1818
InvalidInfoDictionary,
1919

20-
#[display(fmt = "Torrent has an invalid pieces key length. It should be a multiple of 20.")]
20+
#[display("Torrent has an invalid pieces key length. It should be a multiple of 20.")]
2121
InvalidTorrentPiecesLength,
2222

23-
#[display(fmt = "Cannot bencode the parsed `info` dictionary again to generate the info-hash.")]
23+
#[display("Cannot bencode the parsed `info` dictionary again to generate the info-hash.")]
2424
CannotBencodeInfoDict,
2525
}
2626

@@ -72,7 +72,7 @@ pub fn decode_torrent(bytes: &[u8]) -> Result<Torrent, Box<dyn error::Error>> {
7272
/// # Errors
7373
///
7474
/// This function will return an error if unable to bencode torrent.
75-
pub fn encode_torrent(torrent: &Torrent) -> Result<Vec<u8>, Error> {
75+
pub fn encode_torrent(torrent: &Torrent) -> Result<Vec<u8>, SerdeError> {
7676
match serde_bencode::to_bytes(torrent) {
7777
Ok(bencode_bytes) => Ok(bencode_bytes),
7878
Err(e) => {

src/web/api/server/v1/contexts/torrent/errors.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,31 @@ use crate::web::api::server::v1::responses::{json_error_response, ErrorResponseD
66

77
#[derive(Debug, Display, PartialEq, Eq, Error)]
88
pub enum Request {
9-
#[display(fmt = "torrent title bytes are nota valid UTF8 string.")]
9+
#[display("torrent title bytes are nota valid UTF8 string.")]
1010
TitleIsNotValidUtf8,
1111

12-
#[display(fmt = "torrent description bytes are nota valid UTF8 string.")]
12+
#[display("torrent description bytes are nota valid UTF8 string.")]
1313
DescriptionIsNotValidUtf8,
1414

15-
#[display(fmt = "torrent category bytes are nota valid UTF8 string.")]
15+
#[display("torrent category bytes are nota valid UTF8 string.")]
1616
CategoryIsNotValidUtf8,
1717

18-
#[display(fmt = "torrent tags arrays bytes are nota valid UTF8 string array.")]
18+
#[display("torrent tags arrays bytes are nota valid UTF8 string array.")]
1919
TagsArrayIsNotValidUtf8,
2020

21-
#[display(fmt = "torrent tags string is not a valid JSON.")]
21+
#[display("torrent tags string is not a valid JSON.")]
2222
TagsArrayIsNotValidJson,
2323

24-
#[display(
25-
fmt = "upload torrent request header `content-type` should be preferably `application/x-bittorrent` or `application/octet-stream`."
26-
)]
24+
#[display("upload torrent request header `content-type` should be preferably `application/x-bittorrent` or `application/octet-stream`.")]
2725
InvalidFileType,
2826

29-
#[display(fmt = "cannot write uploaded torrent bytes (binary file) into memory.")]
27+
#[display("cannot write uploaded torrent bytes (binary file) into memory.")]
3028
CannotWriteChunkFromUploadedBinary,
3129

32-
#[display(fmt = "cannot read a chunk of bytes from the uploaded torrent file. Review the request body size limit.")]
30+
#[display("cannot read a chunk of bytes from the uploaded torrent file. Review the request body size limit.")]
3331
CannotReadChunkFromUploadedBinary,
3432

35-
#[display(fmt = "provided path param for Info-hash is not valid.")]
33+
#[display("provided path param for Info-hash is not valid.")]
3634
InvalidInfoHashParam,
3735
}
3836

0 commit comments

Comments
 (0)