mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 07:07:07 +03:00
Merge pull request #1363 from AleoHQ/clippy-cleanup
Misc cleanups of warnings & etc
This commit is contained in:
commit
caf27b3243
@ -16,25 +16,15 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BoolAnd(pub bool);
|
||||
|
||||
impl Default for BoolAnd {
|
||||
fn default() -> Self {
|
||||
BoolAnd(false)
|
||||
}
|
||||
}
|
||||
|
||||
impl Monoid for BoolAnd {
|
||||
fn append(self, other: Self) -> Self {
|
||||
BoolAnd(self.0 && other.0)
|
||||
}
|
||||
|
||||
fn append_all(self, others: impl Iterator<Item = Self>) -> Self {
|
||||
for item in others {
|
||||
if !item.0 {
|
||||
return BoolAnd(false);
|
||||
}
|
||||
}
|
||||
BoolAnd(true)
|
||||
fn append_all(self, mut others: impl Iterator<Item = Self>) -> Self {
|
||||
BoolAnd(others.all(|i| i.0))
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ impl<'a> Into<leo_ast::ConditionalStatement> for &ConditionalStatement<'a> {
|
||||
Statement::Block(block) => block.into(),
|
||||
_ => unimplemented!(),
|
||||
},
|
||||
next: self.next.get().as_deref().map(|e| Box::new(e.into())),
|
||||
next: self.next.get().map(|e| Box::new(e.into())),
|
||||
span: self.span.clone().unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ use leo_errors::{AstError, Result, Span};
|
||||
/// Tuple array types and expressions error if a size of 0 is given.
|
||||
/// Compound operators become simple assignments.
|
||||
/// Functions missing output type return a empty tuple.
|
||||
#[derive(Default)]
|
||||
pub struct Canonicalizer {
|
||||
// If we are in a circuit keep track of the circuit name.
|
||||
circuit_name: Option<Identifier>,
|
||||
@ -37,15 +38,6 @@ impl AstPass for Canonicalizer {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Canonicalizer {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
circuit_name: None,
|
||||
in_circuit: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Canonicalizer {
|
||||
pub fn canonicalize_accesses(
|
||||
&mut self,
|
||||
|
@ -35,21 +35,10 @@ impl Default for CompilerOptions {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct AstSnapshotOptions {
|
||||
pub initial: bool,
|
||||
pub imports_resolved: bool,
|
||||
pub canonicalized: bool,
|
||||
pub type_inferenced: bool,
|
||||
}
|
||||
|
||||
impl Default for AstSnapshotOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
initial: false,
|
||||
imports_resolved: false,
|
||||
canonicalized: false,
|
||||
type_inferenced: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,8 +222,3 @@ fn main() -> Result<()> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true() {
|
||||
assert!(true);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ use tracing::span::Span;
|
||||
|
||||
/// Compiler Options wrapper for Build command. Also used by other commands which
|
||||
/// require Build command output as their input.
|
||||
#[derive(StructOpt, Clone, Debug)]
|
||||
#[derive(StructOpt, Clone, Debug, Default)]
|
||||
pub struct BuildOptions {
|
||||
#[structopt(long, help = "Disable constant folding compiler optimization")]
|
||||
pub disable_constant_folding: bool,
|
||||
@ -55,21 +55,6 @@ pub struct BuildOptions {
|
||||
pub enable_type_inferenced_ast_snapshot: bool,
|
||||
}
|
||||
|
||||
impl Default for BuildOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
disable_constant_folding: false,
|
||||
disable_code_elimination: false,
|
||||
disable_all_optimizations: false,
|
||||
enable_all_ast_snapshots: false,
|
||||
enable_initial_ast_snapshot: false,
|
||||
enable_imports_resolved_ast_snapshot: false,
|
||||
enable_canonicalized_ast_snapshot: false,
|
||||
enable_type_inferenced_ast_snapshot: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BuildOptions> for CompilerOptions {
|
||||
fn from(options: BuildOptions) -> Self {
|
||||
if options.disable_all_optimizations {
|
||||
|
@ -66,19 +66,11 @@ impl Default for Update {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Config {
|
||||
pub update: Update,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
update: Update::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Read the config from the `config.toml` file
|
||||
pub fn read_config() -> Result<Self> {
|
||||
|
Loading…
Reference in New Issue
Block a user