Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
fix(src/refs.rs): update lifetime annotations
Merged liw opened 8 months ago

Suggested by new clippy.

Signed-off-by: Lars Wirzenius liw@liw.fi

chore: drop unused type and import

Found by new toolchain.

Signed-off-by: Lars Wirzenius liw@liw.fi

3 files changed +2 -33 f6cab9bb 4cea4f36
modified src/bin/cibtool.rs
@@ -17,7 +17,6 @@ use std::{
};

use clap::Parser;
-
use serde::Serialize;

use radicle::{
    git::Oid,
modified src/bin/cibtoolcmd/run.rs
@@ -264,33 +264,3 @@ impl Leaf for ListRuns {
        Ok(())
    }
}
-

-
#[derive(Serialize)]
-
struct RunInfo {
-
    run_id: String,
-
    timestamp: String,
-
    repo_id: String,
-
    repo_alias: String,
-
    whence: Whence,
-
    info_url: Option<String>,
-
    state: RunState,
-
    result: Option<RunResult>,
-
}
-

-
impl From<&Run> for RunInfo {
-
    fn from(run: &Run) -> Self {
-
        RunInfo {
-
            run_id: run
-
                .adapter_run_id()
-
                .map(|id| id.to_string())
-
                .unwrap_or("unknown".into()),
-
            timestamp: run.timestamp().into(),
-
            repo_id: run.repo_id().to_string(),
-
            repo_alias: run.repo_alias().into(),
-
            whence: run.whence().clone(),
-
            info_url: run.adapter_info_url().map(|url| url.into()),
-
            state: run.state(),
-
            result: run.result().cloned(),
-
        }
-
    }
-
}
modified src/refs.rs
@@ -61,7 +61,7 @@ pub fn branch_from_str(s: &str) -> Result<BranchName, RefError> {
}

/// Convert a branch name to a [`Qualified`]: `refs/heads/main`.
-
pub fn qualified_branch(name: &BranchName) -> Result<Qualified, RefError> {
+
pub fn qualified_branch(name: &BranchName) -> Result<Qualified<'_>, RefError> {
    if name.starts_with("refs/") {
        return Err(RefError::RefsInName(name.to_ref_string()));
    }
@@ -85,7 +85,7 @@ pub fn namespaced_branch<'a>(
}

/// Create a name spaced ref name from a string slice.
-
pub fn namespaced_from_str(s: &str) -> Result<Namespaced, RefError> {
+
pub fn namespaced_from_str(s: &str) -> Result<Namespaced<'_>, RefError> {
    assert!(s.starts_with("refs/namespaces/"));
    let rs = ref_string(s)?;
    Ok(rs