diff --git a/terraform-provider-corsschool/src/client.rs b/terraform-provider-corsschool/src/client.rs index c5aa7e8..1db1993 100644 --- a/terraform-provider-corsschool/src/client.rs +++ b/terraform-provider-corsschool/src/client.rs @@ -40,27 +40,23 @@ impl CorsClient { } pub async fn get_hugo(&self) -> Result { - Ok(do_request(self.client.get(format!("{URL}/hugo"))) + do_request(self.client.get(format!("{URL}/hugo"))) .await? .text() .await - .wrap_err("failed to get hugo")?) + .wrap_err("failed to get hugo") } pub async fn get_class(&self, id: &str) -> Result { - Ok( - do_request_body(self.client.get(format!("{URL}/classes/{id}"))) - .await - .wrap_err("failed to get class")?, - ) + do_request_body(self.client.get(format!("{URL}/classes/{id}"))) + .await + .wrap_err("failed to get class") } pub async fn post_class(&self, class: &dto::Class) -> Result { - Ok( - do_request_body(self.client.post(format!("{URL}/classes")).json(class)) - .await - .wrap_err("creating class")?, - ) + do_request_body(self.client.post(format!("{URL}/classes")).json(class)) + .await + .wrap_err("creating class") } } diff --git a/terustform/src/diag.rs b/terustform/src/diag.rs index 1ea258d..5826151 100644 --- a/terustform/src/diag.rs +++ b/terustform/src/diag.rs @@ -66,13 +66,13 @@ pub trait EyreExt { impl EyreExt for Result { fn eyre_to_tf(self) -> DResult { - self.map_err(|e| Diagnostic::error_string(format!("{:?}", e)).into()) + self.map_err(|e| Diagnostic::error_string(format!("{e:?}")).into()) } } impl From for Diagnostic { fn from(value: E) -> Self { - Self::error_string(format!("{:?}", value)) + Self::error_string(format!("{value:?}")) } } impl From for Diagnostics { diff --git a/terustform/src/server/cert.rs b/terustform/src/server/cert.rs index 3f27ee5..8fbf14b 100644 --- a/terustform/src/server/cert.rs +++ b/terustform/src/server/cert.rs @@ -17,7 +17,7 @@ pub fn generate_cert() -> Result<(tonic::transport::Identity, rcgen::Certificate ]; params.is_ca = IsCa::Ca(rcgen::BasicConstraints::Unconstrained); params.not_before = time::OffsetDateTime::now_utc().saturating_add(Duration::seconds(-30)); - params.not_after = time::OffsetDateTime::now_utc().saturating_add(Duration::seconds(262980)); + params.not_after = time::OffsetDateTime::now_utc().saturating_add(Duration::seconds(262_980)); let mut dn = DistinguishedName::new(); dn.push(DnType::OrganizationName, "HashiCorp"); dn.push(DnType::CommonName, "localhost"); diff --git a/terustform/src/server/grpc.rs b/terustform/src/server/grpc.rs index 2558bc1..5ba0230 100644 --- a/terustform/src/server/grpc.rs +++ b/terustform/src/server/grpc.rs @@ -1,10 +1,12 @@ #![allow(unused_variables, unused_imports)] +#[allow(warnings)] pub mod tfplugin6 { tonic::include_proto!("tfplugin6"); } +#[allow(warnings)] pub mod plugin { tonic::include_proto!("plugin"); } diff --git a/terustform/src/values.rs b/terustform/src/values.rs index 6318f9f..64caa3a 100644 --- a/terustform/src/values.rs +++ b/terustform/src/values.rs @@ -75,7 +75,7 @@ impl Type { if !optionals.is_empty() { parts.push(Value::Array( optionals.iter().map(|v| Value::String(v.clone())).collect(), - )) + )); } Value::Array(parts) @@ -302,7 +302,7 @@ impl Value { rd.set_position(start); // TODO: Handle unknown values better // https://github.com/hashicorp/terraform/blob/main/docs/plugin-protocol/object-wire-format.md#schemaattribute-mapping-rules-for-messagepack - if let Ok(_) = mp::read_fixext1(rd) { + if mp::read_fixext1(rd).is_ok() { return Ok(Value::Unknown); } rd.set_position(start); @@ -388,7 +388,10 @@ impl Value { for expected_attr in attrs.keys() { let is_ok = elems.contains_key(expected_attr); if !is_ok && !optionals.contains(expected_attr) { - return Err(Diagnostic::error_string(format!("expected attribute '{expected_attr}', but it was not present")).into()) + return Err(Diagnostic::error_string(format!( + "expected attribute '{expected_attr}', but it was not present" + )) + .into()); } }