Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix warnings #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ pub trait Validator: Send + Sync {
}

impl Validator for Type {
fn validate(&self, typed: bool) -> Result<(), String> {
fn validate(&self, _typed: bool) -> Result<(), String> {
match *self {
// FIXME: validate that custom type name doesn't have space, etc.
Type::Custom(ref custom) => Ok(()),
Type::Custom(ref _custom) => Ok(()),
_ => Ok(()),
}
}
Expand Down
42 changes: 21 additions & 21 deletions src/yul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl Literal {

impl fmt::Display for Literal {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{}", self.literal));
write!(f, "{}", self.literal)?;
if let Some(yultype) = &self.yultype {
write!(f, ":{}", yultype)
} else {
Expand All @@ -156,7 +156,7 @@ impl fmt::Display for Literal {

impl fmt::Display for Identifier {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{}", self.identifier));
write!(f, "{}", self.identifier)?;
if let Some(yultype) = &self.yultype {
write!(f, ":{}", yultype)
} else {
Expand All @@ -167,44 +167,44 @@ impl fmt::Display for Identifier {

impl fmt::Display for FunctionCall {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{}(", self.identifier));
try!(write!(
write!(f, "{}(", self.identifier)?;
write!(
f,
"{}",
self.arguments
.iter()
.map(|argument| format!("{}", argument))
.collect::<Vec<_>>()
.join(", ")
));
)?;
write!(f, ")")
}
}

impl fmt::Display for FunctionDefinition {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "function {}(", self.name));
try!(write!(
write!(f, "function {}(", self.name)?;
write!(
f,
"{}",
self.parameters
.iter()
.map(|identifier| format!("{}", identifier))
.collect::<Vec<_>>()
.join(", ")
));
try!(write!(f, ")"));
)?;
write!(f, ")")?;
if self.returns.len() > 0 {
try!(write!(f, " -> "));
try!(write!(
write!(f, " -> ")?;
write!(
f,
"{}",
self.returns
.iter()
.map(|identifier| format!("{}", identifier))
.collect::<Vec<_>>()
.join(", ")
));
)?;
}
write!(f, " {}", self.block)
}
Expand All @@ -216,16 +216,16 @@ impl fmt::Display for VariableDeclaration {
if self.identifiers.len() == 0 {
panic!("VariableDeclaration must have identifiers")
}
try!(write!(f, "let "));
try!(write!(
write!(f, "let ")?;
write!(
f,
"{}",
self.identifiers
.iter()
.map(|identifier| format!("{}", identifier))
.collect::<Vec<_>>()
.join(", ")
));
)?;
if let Some(expression) = &self.expression {
write!(f, " := {}", expression)
} else {
Expand All @@ -240,15 +240,15 @@ impl fmt::Display for Assignment {
if self.identifiers.len() == 0 {
panic!("Assignment must have identifiers")
}
try!(write!(
write!(
f,
"{}",
self.identifiers
.iter()
.map(|identifier| format!("{}", identifier))
.collect::<Vec<_>>()
.join(", ")
));
)?;
write!(f, " := {}", self.expression)
}
}
Expand Down Expand Up @@ -285,9 +285,9 @@ impl fmt::Display for Case {

impl fmt::Display for Switch {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "switch {} ", self.expression));
write!(f, "switch {} ", self.expression)?;
for case in &self.cases {
try!(write!(f, "{} ", case));
write!(f, "{} ", case)?;
}
write!(f, "")
}
Expand Down Expand Up @@ -324,9 +324,9 @@ impl fmt::Display for Statement {

impl fmt::Display for Block {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{{"));
write!(f, "{{")?;
for (_, statement) in self.statements.iter().enumerate() {
try!(write!(f, " {}", statement));
write!(f, " {}", statement)?;
}
write!(f, " }}")
}
Expand Down