chore: more clippy

This commit is contained in:
rvcas 2023-02-01 13:23:17 -05:00 committed by Lucas
parent a365649360
commit 99c1c880b0
5 changed files with 12 additions and 11 deletions

View File

@ -87,10 +87,10 @@ impl Hydrator {
self.rigid_type_names.clone() self.rigid_type_names.clone()
} }
pub fn type_from_option_annotation<'a>( pub fn type_from_option_annotation(
&mut self, &mut self,
ast: &Option<Annotation>, ast: &Option<Annotation>,
environment: &mut Environment<'a>, environment: &mut Environment,
) -> Result<Arc<Type>, Error> { ) -> Result<Arc<Type>, Error> {
match ast { match ast {
Some(ast) => self.type_from_annotation(ast, environment), Some(ast) => self.type_from_annotation(ast, environment),
@ -100,10 +100,10 @@ impl Hydrator {
/// Construct a Type from an AST Type annotation. /// Construct a Type from an AST Type annotation.
/// ///
pub fn type_from_annotation<'a>( pub fn type_from_annotation(
&mut self, &mut self,
annotation: &Annotation, annotation: &Annotation,
environment: &mut Environment<'a>, environment: &mut Environment,
) -> Result<Arc<Type>, Error> { ) -> Result<Arc<Type>, Error> {
match annotation { match annotation {
Annotation::Constructor { Annotation::Constructor {

View File

@ -86,7 +86,7 @@ impl Config {
let result: Self = toml::from_str(&raw_config).map_err(|e| Error::TomlLoading { let result: Self = toml::from_str(&raw_config).map_err(|e| Error::TomlLoading {
path: config_path.clone(), path: config_path.clone(),
src: raw_config.clone(), src: raw_config.clone(),
named: NamedSource::new(config_path.display().to_string(), raw_config), named: NamedSource::new(config_path.display().to_string(), raw_config).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.line_col().map(|(line, col)| Span {
start: line, start: line,

View File

@ -46,7 +46,7 @@ impl LocalPackages {
let result: Self = toml::from_str(&src).map_err(|e| Error::TomlLoading { let result: Self = toml::from_str(&src).map_err(|e| Error::TomlLoading {
path: path.clone(), path: path.clone(),
src: src.clone(), src: src.clone(),
named: NamedSource::new(path.display().to_string(), src), named: NamedSource::new(path.display().to_string(), src).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.line_col().map(|(line, col)| Span {
start: line, start: line,

View File

@ -52,7 +52,7 @@ impl Manifest {
let manifest: Self = toml::from_str(&toml).map_err(|e| Error::TomlLoading { let manifest: Self = toml::from_str(&toml).map_err(|e| Error::TomlLoading {
path: manifest_path.clone(), path: manifest_path.clone(),
src: toml.clone(), src: toml.clone(),
named: NamedSource::new(manifest_path.display().to_string(), toml), named: NamedSource::new(manifest_path.display().to_string(), toml).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.line_col().map(|(line, col)| Span {
start: line, start: line,

View File

@ -17,6 +17,7 @@ use owo_colors::OwoColorize;
use std::{ use std::{
fmt::{Debug, Display}, fmt::{Debug, Display},
io, io,
ops::Deref,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use uplc::machine::cost_model::ExBudget; use uplc::machine::cost_model::ExBudget;
@ -60,7 +61,7 @@ pub enum Error {
TomlLoading { TomlLoading {
path: PathBuf, path: PathBuf,
src: String, src: String,
named: NamedSource, named: Box<NamedSource>,
location: Option<Span>, location: Option<Span>,
help: String, help: String,
}, },
@ -108,7 +109,7 @@ pub enum Error {
location: Span, location: Span,
path: PathBuf, path: PathBuf,
src: String, src: String,
named: NamedSource, named: Box<NamedSource>,
}, },
#[error("{name} failed{}", if *verbose { format!("\n{src}") } else { String::new() } )] #[error("{name} failed{}", if *verbose { format!("\n{src}") } else { String::new() } )]
@ -438,10 +439,10 @@ impl Diagnostic for Error {
Error::Type { named, .. } => Some(named), Error::Type { named, .. } => Some(named),
Error::StandardIo(_) => None, Error::StandardIo(_) => None,
Error::MissingManifest { .. } => None, Error::MissingManifest { .. } => None,
Error::TomlLoading { named, .. } => Some(named), Error::TomlLoading { named, .. } => Some(named.deref()),
Error::Format { .. } => None, Error::Format { .. } => None,
Error::ValidatorMustReturnBool { named, .. } => Some(named), Error::ValidatorMustReturnBool { named, .. } => Some(named),
Error::WrongValidatorArity { named, .. } => Some(named), Error::WrongValidatorArity { named, .. } => Some(named.deref()),
Error::TestFailure { .. } => None, Error::TestFailure { .. } => None,
Error::Http(_) => None, Error::Http(_) => None,
Error::ZipExtract(_) => None, Error::ZipExtract(_) => None,