Skip to content

Commit 9b4a92c

Browse files
Merge #1471
1471: Add wildcard lifetimes where they were previously elided r=sgrif a=jtgeibel This diff was created with the following commands: RUSTFLAGS="-W elided_lifetimes_in_paths" cargo +nightly fix cargo +stable fmt Co-authored-by: Justin Geibel <[email protected]>
2 parents 7df140d + fa26a23 commit 9b4a92c

File tree

9 files changed

+29
-25
lines changed

9 files changed

+29
-25
lines changed

src/bin/render-readmes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
274274

275275
/// Search an entry by its path in a Tar archive.
276276
fn find_file_by_path<R: Read>(
277-
entries: &mut tar::Entries<R>,
277+
entries: &mut tar::Entries<'_, R>,
278278
path: &Path,
279279
version: &Version,
280280
krate_name: &str,

src/controllers/helpers/pagination.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<T> QueryFragment<Pg> for Paginated<T>
3232
where
3333
T: QueryFragment<Pg>,
3434
{
35-
fn walk_ast(&self, mut out: AstPass<Pg>) -> QueryResult<()> {
35+
fn walk_ast(&self, mut out: AstPass<'_, Pg>) -> QueryResult<()> {
3636
out.push_sql("SELECT *, COUNT(*) OVER () FROM (");
3737
self.query.walk_ast(out.reborrow())?;
3838
out.push_sql(") t LIMIT ");

src/middleware/log_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Handler for LogRequests {
6363
struct FullPath<'a>(&'a dyn Request);
6464

6565
impl<'a> fmt::Display for FullPath<'a> {
66-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
66+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6767
write!(f, "{}", self.0.path())?;
6868
if let Some(q_string) = self.0.query_string() {
6969
write!(f, "?{}", q_string)?;

src/models/krate.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ impl<'a> NewCrate<'a> {
236236
}
237237

238238
impl Crate {
239-
pub fn with_name(name: &str) -> WithName {
239+
pub fn with_name(name: &str) -> WithName<'_> {
240240
canon_crate_name(crates::name).eq(canon_crate_name(name))
241241
}
242242

243-
pub fn by_name(name: &str) -> ByName {
243+
pub fn by_name(name: &str) -> ByName<'_> {
244244
Crate::all().filter(Self::with_name(name))
245245
}
246246

@@ -557,27 +557,27 @@ mod tests {
557557
}
558558

559559
pub trait CrateVersions {
560-
fn versions(&self) -> versions::BoxedQuery<Pg> {
560+
fn versions(&self) -> versions::BoxedQuery<'_, Pg> {
561561
self.all_versions().filter(versions::yanked.eq(false))
562562
}
563563

564-
fn all_versions(&self) -> versions::BoxedQuery<Pg>;
564+
fn all_versions(&self) -> versions::BoxedQuery<'_, Pg>;
565565
}
566566

567567
impl CrateVersions for Crate {
568-
fn all_versions(&self) -> versions::BoxedQuery<Pg> {
568+
fn all_versions(&self) -> versions::BoxedQuery<'_, Pg> {
569569
Version::belonging_to(self).into_boxed()
570570
}
571571
}
572572

573573
impl CrateVersions for Vec<Crate> {
574-
fn all_versions(&self) -> versions::BoxedQuery<Pg> {
574+
fn all_versions(&self) -> versions::BoxedQuery<'_, Pg> {
575575
self.as_slice().all_versions()
576576
}
577577
}
578578

579579
impl CrateVersions for [Crate] {
580-
fn all_versions(&self) -> versions::BoxedQuery<Pg> {
580+
fn all_versions(&self) -> versions::BoxedQuery<'_, Pg> {
581581
Version::belonging_to(self).into_boxed()
582582
}
583583
}

src/tests/all.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ where
223223

224224
static NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT;
225225

226-
fn new_user(login: &str) -> NewUser {
226+
fn new_user(login: &str) -> NewUser<'_> {
227227
NewUser {
228228
gh_id: NEXT_ID.fetch_add(1, Ordering::SeqCst) as i32,
229229
gh_login: login,
@@ -246,7 +246,7 @@ fn user(login: &str) -> User {
246246
}
247247
}
248248

249-
fn new_team(login: &str) -> NewTeam {
249+
fn new_team(login: &str) -> NewTeam<'_> {
250250
NewTeam {
251251
github_id: NEXT_ID.fetch_add(1, Ordering::SeqCst) as i32,
252252
login: login,
@@ -376,7 +376,7 @@ struct CrateBuilder<'a> {
376376
}
377377

378378
impl<'a> CrateBuilder<'a> {
379-
fn new(name: &str, owner_id: i32) -> CrateBuilder {
379+
fn new(name: &str, owner_id: i32) -> CrateBuilder<'_> {
380380
CrateBuilder {
381381
owner_id: owner_id,
382382
krate: NewCrate {
@@ -588,7 +588,11 @@ fn logout(req: &mut Request) {
588588
req.mut_extensions().pop::<User>();
589589
}
590590

591-
fn request_with_user_and_mock_crate(app: &Arc<App>, user: &NewUser, krate: &str) -> MockRequest {
591+
fn request_with_user_and_mock_crate(
592+
app: &Arc<App>,
593+
user: &NewUser<'_>,
594+
krate: &str,
595+
) -> MockRequest {
592596
let mut req = new_req(Arc::clone(app), krate, "1.0.0");
593597
{
594598
let conn = app.diesel_database.get().unwrap();

src/tests/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn replay_http(
329329
}
330330

331331
impl GhUser {
332-
pub fn user(&'static self) -> NewUser {
332+
pub fn user(&'static self) -> NewUser<'_> {
333333
self.init.call_once(|| self.init());
334334
let mut u = ::new_user(self.login);
335335
u.gh_access_token = Cow::Owned(self.token());

src/util/errors.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub trait CargoError: Send + fmt::Display + 'static {
4242
}
4343

4444
impl fmt::Debug for Box<dyn CargoError> {
45-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4646
fmt::Display::fmt(self, f)
4747
}
4848
}
@@ -150,7 +150,7 @@ impl<E: CargoError> CargoError for ChainedError<E> {
150150
}
151151

152152
impl<E: CargoError> fmt::Display for ChainedError<E> {
153-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
153+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
154154
write!(f, "{} caused by {}", self.error, self.cause)
155155
}
156156
}
@@ -173,7 +173,7 @@ impl<E: Any + Error + Send + 'static> From<E> for Box<dyn CargoError> {
173173
}
174174
}
175175
impl<E: fmt::Display> fmt::Display for Shim<E> {
176-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
176+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
177177
self.0.fmt(f)
178178
}
179179
}
@@ -210,7 +210,7 @@ struct ConcreteCargoError {
210210
}
211211

212212
impl fmt::Display for ConcreteCargoError {
213-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
213+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
214214
write!(f, "{}", self.description)?;
215215
if let Some(ref s) = self.detail {
216216
write!(f, " ({})", s)?;
@@ -251,7 +251,7 @@ impl CargoError for NotFound {
251251
}
252252

253253
impl fmt::Display for NotFound {
254-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
254+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
255255
"Not Found".fmt(f)
256256
}
257257
}
@@ -276,7 +276,7 @@ impl CargoError for Unauthorized {
276276
}
277277

278278
impl fmt::Display for Unauthorized {
279-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
279+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
280280
"must be logged in to perform that action".fmt(f)
281281
}
282282
}
@@ -300,7 +300,7 @@ impl CargoError for BadRequest {
300300
}
301301

302302
impl fmt::Display for BadRequest {
303-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
303+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
304304
self.0.fmt(f)
305305
}
306306
}
@@ -352,7 +352,7 @@ pub fn std_error(e: Box<dyn CargoError>) -> Box<dyn Error + Send> {
352352
}
353353
}
354354
impl fmt::Display for E {
355-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
355+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
356356
write!(f, "{}", self.0)?;
357357

358358
let mut err = &*self.0;

src/util/request_proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'a> Request for RequestProxy<'a> {
2828
fn scheme(&self) -> conduit::Scheme {
2929
self.other.scheme()
3030
}
31-
fn host(&self) -> conduit::Host {
31+
fn host(&self) -> conduit::Host<'_> {
3232
self.other.host()
3333
}
3434
fn virtual_root(&self) -> Option<&str> {

src/views/krate_publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ use diesel::sql_types::Text;
221221
use std::io::Write;
222222

223223
impl ToSql<Text, Pg> for Feature {
224-
fn to_sql<W: Write>(&self, out: &mut Output<W, Pg>) -> serialize::Result {
224+
fn to_sql<W: Write>(&self, out: &mut Output<'_, W, Pg>) -> serialize::Result {
225225
ToSql::<Text, Pg>::to_sql(&**self, out)
226226
}
227227
}

0 commit comments

Comments
 (0)