Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
chore: drop depedency on anyhow
Lars Wirzenius committed 5 months ago
commit 8413204bafff64aa32a64fba4c302d3bf5389b95
parent ac530cf
6 files changed +9 -13
modified Cargo.lock
@@ -2096,7 +2096,6 @@ dependencies = [
name = "radicle-ci-broker"
version = "0.23.0"
dependencies = [
-
 "anyhow",
 "clap",
 "culpa",
 "duration-str",
modified Cargo.toml
@@ -11,7 +11,6 @@ repository = "https://app.radicle.xyz/nodes/radicle.liw.fi/rad:zwTxygwuz5LDGBq25
categories = ["development-tools::build-utils"]

[dependencies]
-
anyhow = "1.0.95"
clap = { version = "4.5.11", features = ["derive", "wrap_help"] }
duration-str = "0.12.0"
html-page = "0.4.0"
modified src/adapter.rs
@@ -476,13 +476,13 @@ mod test {

    const MAX: Duration = Duration::from_secs(10);

-
    fn db() -> anyhow::Result<Db> {
+
    fn db() -> Result<Db, Box<dyn std::error::Error>> {
        let tmp = NamedTempFile::new()?;
        let db = Db::new(tmp.path())?;
        Ok(db)
    }

-
    fn run() -> anyhow::Result<Run> {
+
    fn run() -> Result<Run, Box<dyn std::error::Error>> {
        Ok(RunBuilder::default()
            .broker_run_id(RunId::default())
            .repo_id(RepoId::from_urn("rad:zwTxygwuz5LDGBq255RA2CbNGrz8")?)
modified src/bin/synthetic-events.rs
@@ -27,7 +27,7 @@ fn log(file: &mut File, msg: String) {
    file.write_all(msg.as_bytes()).ok();
}

-
fn main() -> anyhow::Result<()> {
+
fn main() {
    let args = Args::parse();

    if let Err(e) = {
@@ -46,8 +46,6 @@ fn main() -> anyhow::Result<()> {
            e = underlying.source();
        }
    }
-

-
    Ok(())
}

#[derive(Debug, Parser)]
@@ -64,7 +62,7 @@ struct Args {
    events: Vec<PathBuf>,
}

-
fn client(args: &Args) -> anyhow::Result<()> {
+
fn client(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
    println!("connect to {}", args.socket.display());
    {
        let mut stream = UnixStream::connect(&args.socket).unwrap();
@@ -97,8 +95,8 @@ fn client(args: &Args) -> anyhow::Result<()> {
    Ok(())
}

-
fn daemon(args: &Args) -> anyhow::Result<()> {
-
    fn helper(args: &Args, f: &mut File) -> anyhow::Result<()> {
+
fn daemon(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
+
    fn helper(args: &Args, f: &mut File) -> Result<(), Box<dyn std::error::Error>> {
        log(f, "daemon starts\n".into());

        let repeat = args.repeat.unwrap_or(1);
@@ -163,7 +161,7 @@ fn daemon(args: &Args) -> anyhow::Result<()> {
    Ok(())
}

-
fn launch_daemon(args: &Args) -> anyhow::Result<()> {
+
fn launch_daemon(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
    if args.socket.exists() {
        println!("removing socket {}", args.socket.display());
        remove_file(&args.socket)?;
modified src/broker.rs
@@ -220,7 +220,7 @@ mod test {
        test::{TestResult, mock_adapter, trigger_request},
    };

-
    fn broker(filename: &Path) -> anyhow::Result<Broker> {
+
    fn broker(filename: &Path) -> Result<Broker, Box<dyn std::error::Error>> {
        Ok(Broker::new(filename, Duration::from_secs(1))?)
    }

modified src/run.rs
@@ -274,7 +274,7 @@ mod test {
    use super::*;

    #[test]
-
    fn serialize_run_state() -> anyhow::Result<()> {
+
    fn serialize_run_state() -> Result<(), Box<dyn std::error::Error>> {
        let s = serde_json::to_string(&RunState::Finished)?;
        assert_eq!(s, r#""finished""#);
        Ok(())