From c22e161f7bd97d4f6c063513cc051f6af2683d84 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 17 Mar 2020 23:01:35 +0000 Subject: Run clippy --- dhall/src/semantics/resolve/resolve.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'dhall/src/semantics/resolve/resolve.rs') diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs index d29271d..f3fda4b 100644 --- a/dhall/src/semantics/resolve/resolve.rs +++ b/dhall/src/semantics/resolve/resolve.rs @@ -46,13 +46,13 @@ impl ImportLocation { ) -> Result { Ok(match target { ImportTarget::Local(prefix, path) => { - self.chain_local(prefix, path)? + self.chain_local(*prefix, path)? } ImportTarget::Remote(remote) => { if sanity_check { if let ImportLocation::Remote(..) = self { // TODO: allow if CORS check passes - Err(ImportError::SanityCheck)? + return Err(ImportError::SanityCheck.into()); } } let mut url = Url::parse(&format!( @@ -66,7 +66,7 @@ impl ImportLocation { ImportTarget::Env(var_name) => { if sanity_check { if let ImportLocation::Remote(..) = self { - Err(ImportError::SanityCheck)? + return Err(ImportError::SanityCheck.into()); } } ImportLocation::Env(var_name.clone()) @@ -77,7 +77,7 @@ impl ImportLocation { fn chain_local( &self, - prefix: &FilePrefix, + prefix: FilePrefix, path: &FilePath, ) -> Result { Ok(match self { @@ -146,11 +146,11 @@ impl ImportLocation { ImportLocation::Env(var_name) => { let val = match env::var(var_name) { Ok(val) => val, - Err(_) => Err(ImportError::MissingEnvVar)?, + Err(_) => return Err(ImportError::MissingEnvVar.into()), }; Parsed::parse_str(&val)? } - ImportLocation::Missing => Err(ImportError::Missing)?, + ImportLocation::Missing => return Err(ImportError::Missing.into()), }) } @@ -162,9 +162,9 @@ impl ImportLocation { } ImportLocation::Env(var_name) => match env::var(var_name) { Ok(val) => val, - Err(_) => Err(ImportError::MissingEnvVar)?, + Err(_) => return Err(ImportError::MissingEnvVar.into()), }, - ImportLocation::Missing => Err(ImportError::Missing)?, + ImportLocation::Missing => return Err(ImportError::Missing.into()), }) } @@ -199,7 +199,7 @@ fn make_aslocation_uniontype() -> Expr { let mut union = DupTreeMap::default(); union.insert("Local".into(), Some(text_type.clone())); union.insert("Remote".into(), Some(text_type.clone())); - union.insert("Environment".into(), Some(text_type.clone())); + union.insert("Environment".into(), Some(text_type)); union.insert("Missing".into(), None); mkexpr(ExprKind::UnionType(union)) } @@ -298,7 +298,7 @@ fn traverse_resolve_expr( name_env.insert_mut(l); } let hir = traverse_resolve_expr(name_env, e, f)?; - if let Some(_) = l { + if l.is_some() { name_env.remove_mut(); } Ok::<_, Error>(hir) @@ -395,7 +395,7 @@ impl Canonicalize for ImportTarget { authority: url.authority.clone(), path: url.path.canonicalize(), query: url.query.clone(), - headers: url.headers.clone(), + headers: url.headers, }), ImportTarget::Env(name) => ImportTarget::Env(name.to_string()), ImportTarget::Missing => ImportTarget::Missing, -- cgit v1.2.3