diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-07-23 19:21:03 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-07-23 19:31:41 -0400 |
| commit | 4f568db968cced94eb282d1353e43625ee8811bb (patch) | |
| tree | fc823896fa00c4e19ef5c2a2bb1b703314bba5d2 | |
| parent | 5429d2ab901380a92535e31c8cce6646e9b11c4f (diff) | |
Retire the `result` module.
It didn't add much to have our own Result definition, over using `anyhow::Result` directly.
| -rw-r--r-- | src/apply.rs | 2 | ||||
| -rw-r--r-- | src/autoscaling.rs | 3 | ||||
| -rw-r--r-- | src/bin/aws-autoscaling-dns.rs | 6 | ||||
| -rw-r--r-- | src/cli.rs | 5 | ||||
| -rw-r--r-- | src/converge.rs | 3 | ||||
| -rw-r--r-- | src/dns.rs | 6 | ||||
| -rw-r--r-- | src/ec2.rs | 2 | ||||
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | src/result.rs | 4 | ||||
| -rw-r--r-- | src/route53.rs | 3 |
10 files changed, 12 insertions, 23 deletions
diff --git a/src/apply.rs b/src/apply.rs index 8a94642..abf579f 100644 --- a/src/apply.rs +++ b/src/apply.rs @@ -1,6 +1,6 @@ +use anyhow::Result; use aws_sdk_route53::types::{Change, ChangeAction, ChangeBatch, ResourceRecordSet}; -use crate::result::Result; use crate::route53::Route53; pub enum ApplyMode { diff --git a/src/autoscaling.rs b/src/autoscaling.rs index 6c96279..81b9961 100644 --- a/src/autoscaling.rs +++ b/src/autoscaling.rs @@ -1,8 +1,7 @@ -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use aws_sdk_autoscaling as autoscaling; use aws_sdk_autoscaling::types::AutoScalingGroup; -use crate::result::Result; use crate::single::Single; pub trait AutoScaling { diff --git a/src/bin/aws-autoscaling-dns.rs b/src/bin/aws-autoscaling-dns.rs index 6999b6b..589f9d5 100644 --- a/src/bin/aws-autoscaling-dns.rs +++ b/src/bin/aws-autoscaling-dns.rs @@ -1,9 +1,9 @@ use clap::Parser; -use aws_autoscaling_dns::cli; +use aws_autoscaling_dns::cli::Args; #[tokio::main] -async fn main() -> cli::Result { - let args = cli::Args::parse(); +async fn main() -> anyhow::Result<()> { + let args = Args::parse(); args.run().await } @@ -1,5 +1,6 @@ use std::fmt::Debug; +use anyhow::Result; use clap::Parser; use trust_dns_proto::rr::Name; @@ -38,10 +39,8 @@ pub struct Args { apply: bool, } -pub type Result = crate::result::Result<()>; - impl Args { - pub async fn run(self) -> Result { + pub async fn run(self) -> Result<()> { let args = Args::parse(); let name = args.autoscaling_group; diff --git a/src/converge.rs b/src/converge.rs index a858347..5e6b817 100644 --- a/src/converge.rs +++ b/src/converge.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use aws_sdk_autoscaling::types::AutoScalingGroup; use aws_sdk_route53::types::ResourceRecordSet; use futures::try_join; @@ -10,7 +10,6 @@ use crate::autoscaling::{asg_by_name, AutoScaling}; use crate::dns::AutoScalingGroupConfig; use crate::ec2::{instance_recordsets, Ec2}; use crate::hashable::Hashable; -use crate::result::Result; use crate::route53::{zone_for_domain, zone_suffix_recordsets, Route53}; #[derive(Debug)] @@ -1,12 +1,10 @@ use std::convert::TryFrom; use std::fmt::Debug; -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use aws_sdk_autoscaling::types::{AutoScalingGroup, Instance, LifecycleState}; use trust_dns_proto::rr::Name; -use crate::result::{Error, Result}; - #[derive(Debug)] pub struct AutoScalingGroupConfig { pub name: String, @@ -34,7 +32,7 @@ impl AutoScalingGroupConfig { } impl TryFrom<&AutoScalingGroup> for AutoScalingGroupConfig { - type Error = Error; + type Error = anyhow::Error; fn try_from(autoscaling_group: &AutoScalingGroup) -> Result<Self> { let name = autoscaling_group @@ -1,5 +1,6 @@ use std::collections::HashSet; +use anyhow::Result; use aws_sdk_ec2 as ec2; use aws_sdk_ec2::types::Filter; use aws_sdk_route53::types::{ResourceRecordSet, RrType}; @@ -8,7 +9,6 @@ use trust_dns_proto::rr::Name; use crate::dns::absolute; use crate::hashable::Hashable; -use crate::result::Result; use crate::route53::recordset; pub trait Ec2 { @@ -6,6 +6,5 @@ mod converge; mod dns; mod ec2; mod hashable; -mod result; mod route53; mod single; diff --git a/src/result.rs b/src/result.rs deleted file mode 100644 index 7c607c5..0000000 --- a/src/result.rs +++ /dev/null @@ -1,4 +0,0 @@ -use anyhow; - -pub type Error = anyhow::Error; -pub type Result<T> = std::result::Result<T, Error>; diff --git a/src/route53.rs b/src/route53.rs index 67bccb5..89f4b03 100644 --- a/src/route53.rs +++ b/src/route53.rs @@ -1,14 +1,13 @@ use std::collections::HashSet; use std::str::FromStr; -use anyhow::anyhow; +use anyhow::{anyhow, Result}; use aws_sdk_route53 as route53; use aws_sdk_route53::types::{HostedZone, ResourceRecord, ResourceRecordSet, RrType}; use trust_dns_proto::rr::Name; use crate::dns::suffixes; use crate::hashable::Hashable; -use crate::result::Result; pub trait Route53 { fn route53(&self) -> &route53::Client; |
