Skip to content

Commit 3bb49b4

Browse files
committed
Run cargo +stable fix --edition-idioms
1 parent 7b62749 commit 3bb49b4

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

src/models/category.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ pub struct CrateCategory {
6161
}
6262

6363
impl Category {
64-
pub fn with_slug(slug: &str) -> WithSlug {
64+
pub fn with_slug(slug: &str) -> WithSlug<'_> {
6565
categories::slug.eq(crate::lower(slug))
6666
}
6767

68-
pub fn by_slug(slug: &str) -> BySlug {
68+
pub fn by_slug(slug: &str) -> BySlug<'_> {
6969
Category::all().filter(Self::with_slug(slug))
7070
}
7171

src/models/team.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Team {
118118
// "sanitization"
119119
fn whitelist(c: char) -> bool {
120120
match c {
121-
'a'...'z' | 'A'...'Z' | '0'...'9' | '-' | '_' => false,
121+
'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => false,
122122
_ => true,
123123
}
124124
}

src/tests/all.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fn add_team_to_crate(t: &Team, krate: &Crate, u: &User, conn: &PgConnection) ->
240240
Ok(())
241241
}
242242

243-
fn sign_in_as(req: &mut Request, user: &User) {
243+
fn sign_in_as(req: &mut dyn Request, user: &User) {
244244
req.mut_extensions().insert(user.clone());
245245
req.mut_extensions()
246246
.insert(AuthenticationSource::SessionCookie);
@@ -271,6 +271,6 @@ fn new_category<'a>(category: &'a str, slug: &'a str, description: &'a str) -> N
271271
}
272272
}
273273

274-
fn logout(req: &mut Request) {
274+
fn logout(req: &mut dyn Request) {
275275
req.mut_extensions().pop::<User>();
276276
}

src/tests/builders.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,15 @@ impl PublishBuilder {
358358
.zip(&mut slices)
359359
.map(|(&(name, _), data)| {
360360
let len = data.len() as u64;
361-
(name, data as &mut Read, len)
361+
(name, data as &mut dyn Read, len)
362362
})
363363
.collect::<Vec<_>>();
364364

365365
self.files_with_io(&mut files)
366366
}
367367

368368
/// Set the tarball from a Read trait object
369-
pub fn files_with_io(mut self, files: &mut [(&str, &mut Read, u64)]) -> Self {
369+
pub fn files_with_io(mut self, files: &mut [(&str, &mut dyn Read, u64)]) -> Self {
370370
let mut tarball = Vec::new();
371371
{
372372
let mut ar = tar::Builder::new(GzEncoder::new(&mut tarball, Compression::default()));

src/tests/record.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ impl hyper::service::Service for Proxy {
150150
type ReqBody = hyper::Body;
151151
type ResBody = hyper::Body;
152152
type Error = hyper::Error;
153-
type Future = Box<Future<Item = hyper::Response<Self::ResBody>, Error = Self::Error> + Send>;
153+
type Future =
154+
Box<dyn Future<Item = hyper::Response<Self::ResBody>, Error = Self::Error> + Send>;
154155

155156
fn call(&mut self, req: hyper::Request<Self::ReqBody>) -> Self::Future {
156157
let record2 = self.record.clone();
@@ -175,7 +176,7 @@ impl hyper::service::NewService for Proxy {
175176
type ResBody = hyper::Body;
176177
type Error = hyper::Error;
177178
type Service = Proxy;
178-
type Future = Box<Future<Item = Self::Service, Error = Self::InitError> + Send>;
179+
type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError> + Send>;
179180
type InitError = hyper::Error;
180181

181182
fn new_service(&self) -> Self::Future {
@@ -209,7 +210,7 @@ type Client = hyper::Client<hyper_tls::HttpsConnector<hyper::client::HttpConnect
209210
fn record_http(
210211
req: hyper::Request<hyper::Body>,
211212
client: &Client,
212-
) -> Box<Future<Item = (hyper::Response<hyper::Body>, Exchange), Error = hyper::Error> + Send> {
213+
) -> Box<dyn Future<Item = (hyper::Response<hyper::Body>, Exchange), Error = hyper::Error> + Send> {
213214
let (header_parts, body) = req.into_parts();
214215
let method = header_parts.method;
215216
let uri = header_parts.uri;
@@ -266,8 +267,8 @@ fn record_http(
266267
fn replay_http(
267268
req: hyper::Request<hyper::Body>,
268269
mut exchange: Exchange,
269-
stdout: &mut Write,
270-
) -> Box<Future<Item = hyper::Response<hyper::Body>, Error = hyper::Error> + Send> {
270+
stdout: &mut dyn Write,
271+
) -> Box<dyn Future<Item = hyper::Response<hyper::Body>, Error = hyper::Error> + Send> {
271272
static IGNORED_HEADERS: &[&str] = &["authorization", "date", "user-agent"];
272273

273274
assert_eq!(req.uri().to_string(), exchange.request.uri);

src/tests/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,13 @@ pub struct Bad {
323323

324324
pub type DieselConnection =
325325
diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
326-
type ResponseResult = Result<conduit::Response, Box<std::error::Error + Send>>;
326+
type ResponseResult = Result<conduit::Response, Box<dyn std::error::Error + Send>>;
327327

328328
/// A type providing helper methods for working with responses
329329
#[must_use]
330330
pub struct Response<T> {
331331
response: conduit::Response,
332-
callback_on_good: Option<Box<Fn(&T)>>,
332+
callback_on_good: Option<Box<dyn Fn(&T)>>,
333333
}
334334

335335
impl<T> Response<T>
@@ -343,7 +343,7 @@ where
343343
}
344344
}
345345

346-
fn with_callback(self, callback_on_good: Box<Fn(&T)>) -> Self {
346+
fn with_callback(self, callback_on_good: Box<dyn Fn(&T)>) -> Self {
347347
Self {
348348
response: self.response,
349349
callback_on_good: Some(callback_on_good),

0 commit comments

Comments
 (0)