Skip to content

Commit 80ce924

Browse files
committed
chore(deps): bump derive_more from 0.99.18 to 1.0.0
1 parent 02e29e9 commit 80ce924

File tree

9 files changed

+99
-110
lines changed

9 files changed

+99
-110
lines changed

Cargo.lock

+18-25
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

0 commit comments

Comments
 (0)