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

View File

@ -86,7 +86,7 @@ impl Config {
let result: Self = toml::from_str(&raw_config).map_err(|e| Error::TomlLoading {
path: config_path.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
location: e.line_col().map(|(line, col)| Span {
start: line,

View File

@ -46,7 +46,7 @@ impl LocalPackages {
let result: Self = toml::from_str(&src).map_err(|e| Error::TomlLoading {
path: path.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
location: e.line_col().map(|(line, col)| Span {
start: line,

View File

@ -52,7 +52,7 @@ impl Manifest {
let manifest: Self = toml::from_str(&toml).map_err(|e| Error::TomlLoading {
path: manifest_path.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
location: e.line_col().map(|(line, col)| Span {
start: line,

View File

@ -17,6 +17,7 @@ use owo_colors::OwoColorize;
use std::{
fmt::{Debug, Display},
io,
ops::Deref,
path::{Path, PathBuf},
};
use uplc::machine::cost_model::ExBudget;
@ -60,7 +61,7 @@ pub enum Error {
TomlLoading {
path: PathBuf,
src: String,
named: NamedSource,
named: Box<NamedSource>,
location: Option<Span>,
help: String,
},
@ -108,7 +109,7 @@ pub enum Error {
location: Span,
path: PathBuf,
src: String,
named: NamedSource,
named: Box<NamedSource>,
},
#[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::StandardIo(_) => None,
Error::MissingManifest { .. } => None,
Error::TomlLoading { named, .. } => Some(named),
Error::TomlLoading { named, .. } => Some(named.deref()),
Error::Format { .. } => None,
Error::ValidatorMustReturnBool { named, .. } => Some(named),
Error::WrongValidatorArity { named, .. } => Some(named),
Error::WrongValidatorArity { named, .. } => Some(named.deref()),
Error::TestFailure { .. } => None,
Error::Http(_) => None,
Error::ZipExtract(_) => None,