mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 09:33:01 +03:00
Fix clippy warnings after toolchain date bump
This commit is contained in:
parent
b772146acc
commit
1fa97d4468
@ -150,7 +150,7 @@ fn matches_all(branch: &BranchListing, filter: BranchListingFilter) -> bool {
|
||||
if let Some(local) = filter.local {
|
||||
conditions.push((branch.has_local || branch.virtual_branch.is_some()) && local);
|
||||
}
|
||||
return conditions.iter().all(|&x| x);
|
||||
conditions.iter().all(|&x| x)
|
||||
}
|
||||
|
||||
fn combine_branches(
|
||||
|
@ -5,7 +5,7 @@ pub trait BranchExt {
|
||||
fn reference_name(&self) -> Result<ReferenceName>;
|
||||
}
|
||||
|
||||
impl<'repo> BranchExt for git2::Branch<'repo> {
|
||||
impl BranchExt for git2::Branch<'_> {
|
||||
fn reference_name(&self) -> Result<ReferenceName> {
|
||||
let name = self.get().name().context("Failed to get branch name")?;
|
||||
|
||||
|
@ -31,7 +31,7 @@ pub trait ReferenceExtGix {
|
||||
fn identity(&self, remotes: &BTreeSet<Cow<'_, BStr>>) -> Result<BranchIdentity>;
|
||||
}
|
||||
|
||||
impl<'repo> ReferenceExt for git2::Reference<'repo> {
|
||||
impl ReferenceExt for git2::Reference<'_> {
|
||||
fn given_name(&self, remotes: &git2::string_array::StringArray) -> Result<String> {
|
||||
if self.is_remote() {
|
||||
let shorthand_name = self
|
||||
|
@ -13,7 +13,7 @@ pub trait CommitExt {
|
||||
fn is_conflicted(&self) -> bool;
|
||||
}
|
||||
|
||||
impl<'repo> CommitExt for git2::Commit<'repo> {
|
||||
impl CommitExt for git2::Commit<'_> {
|
||||
fn message_bstr(&self) -> &BStr {
|
||||
self.message_bytes().as_ref()
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ static mut GLOBAL_ASKPASS_BROKER: Option<AskpassBroker> = None;
|
||||
/// before any other function from this module is called. **Calls to [`get_broker`] before [`init`] will panic.**
|
||||
///
|
||||
/// This function is **NOT** thread safe.
|
||||
#[allow(static_mut_refs)]
|
||||
pub unsafe fn init(submit_prompt: impl Fn(PromptEvent<Context>) + Send + Sync + 'static) {
|
||||
GLOBAL_ASKPASS_BROKER.replace(AskpassBroker::init(submit_prompt));
|
||||
}
|
||||
@ -22,6 +23,7 @@ pub unsafe fn init(submit_prompt: impl Fn(PromptEvent<Context>) + Send + Sync +
|
||||
///
|
||||
/// # Panics
|
||||
/// Will panic if [`init`] was not called before this function.
|
||||
#[allow(static_mut_refs)]
|
||||
pub fn get_broker() -> &'static AskpassBroker {
|
||||
unsafe {
|
||||
GLOBAL_ASKPASS_BROKER
|
||||
|
@ -67,9 +67,10 @@ pub trait RepositoryExt {
|
||||
/// Returns the computed signature.
|
||||
fn sign_buffer(&self, buffer: &[u8]) -> Result<BString>;
|
||||
|
||||
fn checkout_index_builder<'a>(&'a self, index: &'a mut git2::Index) -> CheckoutIndexBuilder;
|
||||
fn checkout_index_builder<'a>(&'a self, index: &'a mut git2::Index)
|
||||
-> CheckoutIndexBuilder<'a>;
|
||||
fn checkout_index_path_builder<P: AsRef<Path>>(&self, path: P) -> Result<()>;
|
||||
fn checkout_tree_builder<'a>(&'a self, tree: &'a git2::Tree<'a>) -> CheckoutTreeBuidler;
|
||||
fn checkout_tree_builder<'a>(&'a self, tree: &'a git2::Tree<'a>) -> CheckoutTreeBuidler<'a>;
|
||||
fn maybe_find_branch_by_refname(&self, name: &Refname) -> Result<Option<git2::Branch>>;
|
||||
/// Based on the index, add all data similar to `git add .` and create a tree from it, which is returned.
|
||||
fn create_wd_tree(&self) -> Result<Tree>;
|
||||
@ -124,7 +125,10 @@ impl RepositoryExt for git2::Repository {
|
||||
Ok(repo)
|
||||
}
|
||||
|
||||
fn checkout_index_builder<'a>(&'a self, index: &'a mut git2::Index) -> CheckoutIndexBuilder {
|
||||
fn checkout_index_builder<'a>(
|
||||
&'a self,
|
||||
index: &'a mut git2::Index,
|
||||
) -> CheckoutIndexBuilder<'a> {
|
||||
CheckoutIndexBuilder {
|
||||
index,
|
||||
repo: self,
|
||||
@ -142,7 +146,7 @@ impl RepositoryExt for git2::Repository {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
fn checkout_tree_builder<'a>(&'a self, tree: &'a git2::Tree<'a>) -> CheckoutTreeBuidler {
|
||||
fn checkout_tree_builder<'a>(&'a self, tree: &'a git2::Tree<'a>) -> CheckoutTreeBuidler<'a> {
|
||||
CheckoutTreeBuidler {
|
||||
tree,
|
||||
repo: self,
|
||||
|
@ -19,7 +19,7 @@ pub(crate) fn to_https_url(url: &Url) -> Result<Url, ConvertError> {
|
||||
scheme: Scheme::Https,
|
||||
user: None,
|
||||
serialize_alternative_form: true,
|
||||
path: if url.path.starts_with(&[b'/']) {
|
||||
path: if url.path.starts_with(b"/") {
|
||||
url.path.clone()
|
||||
} else {
|
||||
format!("/{}", url.path.to_str().unwrap()).into()
|
||||
@ -40,7 +40,7 @@ pub(crate) fn to_ssh_url(url: &Url) -> Result<Url, ConvertError> {
|
||||
scheme: Scheme::Ssh,
|
||||
user: Some("git".to_string()),
|
||||
serialize_alternative_form: true,
|
||||
path: if url.path.starts_with(&[b'/']) {
|
||||
path: if url.path.starts_with(b"/") {
|
||||
url.path.trim_start_with(|c| c == '/').into()
|
||||
} else {
|
||||
url.path.clone()
|
||||
|
@ -94,7 +94,7 @@ pub fn parse(input: &BStr) -> Result<Url, Error> {
|
||||
}
|
||||
let input_starts_with_file_protocol = input.starts_with(b"file://");
|
||||
if input_starts_with_file_protocol {
|
||||
let wanted = &[b'/'];
|
||||
let wanted = b"/";
|
||||
if !wanted.iter().any(|w| path.contains(w)) {
|
||||
return Err(Error::MissingRepositoryPath);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user