Skip to content

Commit

Permalink
fix or allow elided_named_lifetimes warning
Browse files Browse the repository at this point in the history
Summary:
There are a couple of places where we were relying on elided lifetimes implicity matching with an already-named lifetime.  This is now a warning, so let's stop doing that.

For `hgproto::sshproto::request`, this comes from the use of `nom` macros, so suppress the warning there.

For `derived_data_manager::manager::derive`, we were matching on the lifetime added by `async_recursion`, so we need to explicitly name the lifetime to get around this.

Reviewed By: mitrandir77, RajivTS

Differential Revision: D67735986

fbshipit-source-id: da58202d48859bd0238704e8e8ce9e8a84093ddf
  • Loading branch information
markbt authored and facebook-github-bot committed Dec 31, 2024
1 parent b1f19b2 commit 99ac1de
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eden/mononoke/cmdlib/src/args/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl<'a> MononokeMatches<'a> {
self.matches.is_present(name)
}

pub fn subcommand(&'a self) -> (&str, Option<&'a ArgMatches<'a>>) {
pub fn subcommand(&self) -> (&str, Option<&ArgMatches<'a>>) {
self.matches.subcommand()
}

Expand Down
6 changes: 3 additions & 3 deletions eden/mononoke/derived_data/manager/manager/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ impl DerivedDataManager {
#[async_recursion]
/// Returns the appropriate manager to derive given changeset, either this
/// manager, or some secondary manager in the chain.
async fn get_manager(
&self,
async fn get_manager<'s>(
&'s self,
ctx: &CoreContext,
cs_id: ChangesetId,
) -> anyhow::Result<&DerivedDataManager> {
) -> anyhow::Result<&'s DerivedDataManager> {
Ok(if let Some(secondary) = &self.inner.secondary {
if secondary
.assigner
Expand Down
2 changes: 2 additions & 0 deletions eden/mononoke/hgproto/src/sshproto/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* GNU General Public License version 2.
*/

#![allow(elided_named_lifetimes)]

use std::collections::HashMap;
use std::iter;
use std::str;
Expand Down
6 changes: 3 additions & 3 deletions eden/mononoke/mononoke_types/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,14 @@ impl AsRef<[MPathElement]> for NonRootMPath {

pub fn non_root_mpath_element_iter<'a>(
mpath: &'a Option<NonRootMPath>,
) -> Box<dyn Iterator<Item = &MPathElement> + 'a> {
) -> Box<dyn Iterator<Item = &'a MPathElement> + 'a> {
match mpath {
Some(path) => Box::new(path.into_iter()),
None => Box::new(std::iter::empty()),
}
}

pub fn mpath_element_iter<'a>(mpath: &'a MPath) -> Box<dyn Iterator<Item = &MPathElement> + 'a> {
pub fn mpath_element_iter<'a>(mpath: &'a MPath) -> Box<dyn Iterator<Item = &'a MPathElement> + 'a> {
Box::new(mpath.into_iter())
}

Expand Down Expand Up @@ -1264,7 +1264,7 @@ pub struct CaseConflictTrie<'a> {
}

impl<'a> CaseConflictTrie<'a> {
fn new(exclusions: &'a PrefixTrie) -> CaseConflictTrie {
fn new(exclusions: &'a PrefixTrie) -> CaseConflictTrie<'a> {
CaseConflictTrie {
children: Default::default(),
lowercase_to_original: Default::default(),
Expand Down

0 comments on commit 99ac1de

Please sign in to comment.