mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 15:20:16 +00:00
style: Misc clippy fixes (#327)
* Add warn(rust_2018_idioms) to remaining crates air-beautifier, air-beautify and air-trace now have this lint too. * Fix more warnings
This commit is contained in:
parent
204b2be44d
commit
89355d9da3
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -50,7 +50,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "air-beautifier"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"air-parser",
|
||||
"itertools 0.10.3",
|
||||
@ -59,7 +59,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "air-beautify"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"air-beautifier",
|
||||
"anyhow",
|
||||
@ -141,7 +141,7 @@ version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "air-parser"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"air-lambda-ast",
|
||||
"air-lambda-parser",
|
||||
@ -191,7 +191,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "air-trace"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"air",
|
||||
"air-interpreter-interface",
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "air-parser"
|
||||
description = "Parser of the AIR scripts in a form of string to AST"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
@ -120,7 +120,7 @@ impl<'input> AIRLexer<'input> {
|
||||
fn advance_to_token_end(&mut self, start_pos: usize, square_met: bool) -> usize {
|
||||
let mut end_pos = start_pos;
|
||||
let mut round_brackets_balance: i64 = 0;
|
||||
let mut square_brackets_balance: i64 = if square_met { 1 } else { 0 };
|
||||
let mut square_brackets_balance = i64::from(square_met);
|
||||
|
||||
while let Some((pos, ch)) = self.chars.peek() {
|
||||
end_pos = *pos;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "air-beautifier"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "AIR human-readable format transformer library"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
|
@ -14,16 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
unused_imports,
|
||||
unused_mut,
|
||||
unused_variables,
|
||||
unused_unsafe,
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
use air_parser::ast;
|
||||
|
||||
use std::fmt::Display;
|
||||
@ -131,7 +121,7 @@ impl<W: io::Write> Beautifier<W> {
|
||||
Ok(self.beautify_walker(ast.as_ref(), 0)?)
|
||||
}
|
||||
|
||||
fn beautify_walker(&mut self, node: &ast::Instruction, indent: usize) -> io::Result<()> {
|
||||
fn beautify_walker(&mut self, node: &ast::Instruction<'_>, indent: usize) -> io::Result<()> {
|
||||
match node {
|
||||
ast::Instruction::Call(call) => self.beautify_call(call, indent),
|
||||
ast::Instruction::Ap(ap) => self.beautify_simple(ap, indent),
|
||||
@ -155,7 +145,7 @@ impl<W: io::Write> Beautifier<W> {
|
||||
}
|
||||
}
|
||||
|
||||
fn beautify_call(&mut self, call: &ast::Call, indent: usize) -> io::Result<()> {
|
||||
fn beautify_call(&mut self, call: &ast::Call<'_>, indent: usize) -> io::Result<()> {
|
||||
fmt_indent(&mut self.output, indent)?;
|
||||
match &call.output {
|
||||
ast::CallOutputValue::Scalar(v) => write!(&mut self.output, "{} <- ", v)?,
|
||||
@ -175,12 +165,12 @@ impl<W: io::Write> Beautifier<W> {
|
||||
writeln!(&mut self.output, "{}", instruction)
|
||||
}
|
||||
|
||||
fn beautify_seq(&mut self, seq: &ast::Seq, indent: usize) -> io::Result<()> {
|
||||
fn beautify_seq(&mut self, seq: &ast::Seq<'_>, indent: usize) -> io::Result<()> {
|
||||
self.beautify_walker(&seq.0, indent)?;
|
||||
self.beautify_walker(&seq.1, indent)
|
||||
}
|
||||
|
||||
fn beautify_par(&mut self, par: &ast::Par, indent: usize) -> io::Result<()> {
|
||||
fn beautify_par(&mut self, par: &ast::Par<'_>, indent: usize) -> io::Result<()> {
|
||||
multiline!(
|
||||
self, indent;
|
||||
"par:";
|
||||
@ -190,7 +180,7 @@ impl<W: io::Write> Beautifier<W> {
|
||||
)
|
||||
}
|
||||
|
||||
fn beautify_xor(&mut self, xor: &ast::Xor, indent: usize) -> io::Result<()> {
|
||||
fn beautify_xor(&mut self, xor: &ast::Xor<'_>, indent: usize) -> io::Result<()> {
|
||||
multiline!(
|
||||
self, indent;
|
||||
"try:";
|
||||
@ -200,23 +190,31 @@ impl<W: io::Write> Beautifier<W> {
|
||||
)
|
||||
}
|
||||
|
||||
fn beautify_match(&mut self, match_: &ast::Match, indent: usize) -> io::Result<()> {
|
||||
fn beautify_match(&mut self, match_: &ast::Match<'_>, indent: usize) -> io::Result<()> {
|
||||
compound!(self, indent, match_)
|
||||
}
|
||||
|
||||
fn beautify_mismatch(&mut self, mismatch: &ast::MisMatch, indent: usize) -> io::Result<()> {
|
||||
fn beautify_mismatch(&mut self, mismatch: &ast::MisMatch<'_>, indent: usize) -> io::Result<()> {
|
||||
compound!(self, indent, mismatch)
|
||||
}
|
||||
|
||||
fn beautify_fold_scalar(&mut self, fold: &ast::FoldScalar, indent: usize) -> io::Result<()> {
|
||||
fn beautify_fold_scalar(
|
||||
&mut self,
|
||||
fold: &ast::FoldScalar<'_>,
|
||||
indent: usize,
|
||||
) -> io::Result<()> {
|
||||
compound!(self, indent, fold)
|
||||
}
|
||||
|
||||
fn beautify_fold_stream(&mut self, fold: &ast::FoldStream, indent: usize) -> io::Result<()> {
|
||||
fn beautify_fold_stream(
|
||||
&mut self,
|
||||
fold: &ast::FoldStream<'_>,
|
||||
indent: usize,
|
||||
) -> io::Result<()> {
|
||||
compound!(self, indent, fold)
|
||||
}
|
||||
|
||||
fn beautify_new(&mut self, new: &ast::New, indent: usize) -> io::Result<()> {
|
||||
fn beautify_new(&mut self, new: &ast::New<'_>, indent: usize) -> io::Result<()> {
|
||||
compound!(self, indent, new)
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "air-beautify"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
description = "AIR human-readable format transformer binary"
|
||||
authors = ["Fluence Labs"]
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "air-trace"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
description = "AIR performance tracing tool"
|
||||
authors = ["Fluence Labs"]
|
||||
|
@ -14,6 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
unused_imports,
|
||||
unused_mut,
|
||||
unused_variables,
|
||||
unused_unsafe,
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
mod run;
|
||||
mod stats;
|
||||
mod utils;
|
||||
|
@ -29,9 +29,9 @@ pub(crate) struct AnomalyDataArgs {
|
||||
anomaly_data_path: PathBuf,
|
||||
}
|
||||
|
||||
pub(crate) fn load(args: &AnomalyDataArgs) -> anyhow::Result<super::ExecutionData> {
|
||||
pub(crate) fn load(args: &AnomalyDataArgs) -> anyhow::Result<super::ExecutionData<'_>> {
|
||||
let anomaly_json = load_data(&args.anomaly_data_path).context("Failed to read anomaly data")?;
|
||||
let anomaly_data: AnomalyData =
|
||||
let anomaly_data: AnomalyData<'_> =
|
||||
serde_json::from_str(&anomaly_json).context("Failed to parse anomaly data")?;
|
||||
|
||||
let air_script = anomaly_data.air_script.to_string();
|
||||
|
@ -41,7 +41,7 @@ pub(crate) struct PlainDataArgs {
|
||||
data_path: PathBuf,
|
||||
}
|
||||
|
||||
pub(crate) fn load(args: &PlainDataArgs) -> anyhow::Result<ExecutionData> {
|
||||
pub(crate) fn load(args: &PlainDataArgs) -> anyhow::Result<ExecutionData<'_>> {
|
||||
use crate::run::load_data;
|
||||
|
||||
let air_script =
|
||||
|
@ -73,7 +73,7 @@ impl LogRecord {
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Message {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Message::New => write!(f, "new"),
|
||||
Message::Enter => write!(f, "enter"),
|
||||
@ -83,7 +83,7 @@ impl std::fmt::Display for Message {
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CloseMessage {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "idle={}, busy={}", self.time_idle, self.time_busy)
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ fn format_argument(val: &serde_json::Value) -> String {
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Span {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
use itertools::Itertools as _;
|
||||
|
||||
self.name.fmt(f)?;
|
||||
|
Loading…
Reference in New Issue
Block a user