mirror of
https://github.com/fluencelabs/aquavm
synced 2025-05-28 15:11:22 +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]]
|
[[package]]
|
||||||
name = "air-beautifier"
|
name = "air-beautifier"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air-parser",
|
"air-parser",
|
||||||
"itertools 0.10.3",
|
"itertools 0.10.3",
|
||||||
@ -59,7 +59,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "air-beautify"
|
name = "air-beautify"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air-beautifier",
|
"air-beautifier",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -141,7 +141,7 @@ version = "0.1.0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "air-parser"
|
name = "air-parser"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air-lambda-ast",
|
"air-lambda-ast",
|
||||||
"air-lambda-parser",
|
"air-lambda-parser",
|
||||||
@ -191,7 +191,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "air-trace"
|
name = "air-trace"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air",
|
"air",
|
||||||
"air-interpreter-interface",
|
"air-interpreter-interface",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "air-parser"
|
name = "air-parser"
|
||||||
description = "Parser of the AIR scripts in a form of string to AST"
|
description = "Parser of the AIR scripts in a form of string to AST"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "Apache-2.0"
|
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 {
|
fn advance_to_token_end(&mut self, start_pos: usize, square_met: bool) -> usize {
|
||||||
let mut end_pos = start_pos;
|
let mut end_pos = start_pos;
|
||||||
let mut round_brackets_balance: i64 = 0;
|
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() {
|
while let Some((pos, ch)) = self.chars.peek() {
|
||||||
end_pos = *pos;
|
end_pos = *pos;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "air-beautifier"
|
name = "air-beautifier"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "AIR human-readable format transformer library"
|
description = "AIR human-readable format transformer library"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
@ -14,16 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#![deny(
|
|
||||||
dead_code,
|
|
||||||
nonstandard_style,
|
|
||||||
unused_imports,
|
|
||||||
unused_mut,
|
|
||||||
unused_variables,
|
|
||||||
unused_unsafe,
|
|
||||||
unreachable_patterns
|
|
||||||
)]
|
|
||||||
|
|
||||||
use air_parser::ast;
|
use air_parser::ast;
|
||||||
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
@ -131,7 +121,7 @@ impl<W: io::Write> Beautifier<W> {
|
|||||||
Ok(self.beautify_walker(ast.as_ref(), 0)?)
|
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 {
|
match node {
|
||||||
ast::Instruction::Call(call) => self.beautify_call(call, indent),
|
ast::Instruction::Call(call) => self.beautify_call(call, indent),
|
||||||
ast::Instruction::Ap(ap) => self.beautify_simple(ap, 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)?;
|
fmt_indent(&mut self.output, indent)?;
|
||||||
match &call.output {
|
match &call.output {
|
||||||
ast::CallOutputValue::Scalar(v) => write!(&mut self.output, "{} <- ", v)?,
|
ast::CallOutputValue::Scalar(v) => write!(&mut self.output, "{} <- ", v)?,
|
||||||
@ -175,12 +165,12 @@ impl<W: io::Write> Beautifier<W> {
|
|||||||
writeln!(&mut self.output, "{}", instruction)
|
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.0, indent)?;
|
||||||
self.beautify_walker(&seq.1, 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!(
|
multiline!(
|
||||||
self, indent;
|
self, indent;
|
||||||
"par:";
|
"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!(
|
multiline!(
|
||||||
self, indent;
|
self, indent;
|
||||||
"try:";
|
"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_)
|
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)
|
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)
|
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)
|
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)
|
compound!(self, indent, new)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
#![deny(
|
#![deny(
|
||||||
dead_code,
|
dead_code,
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "air-beautify"
|
name = "air-beautify"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "AIR human-readable format transformer binary"
|
description = "AIR human-readable format transformer binary"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
#![deny(
|
#![deny(
|
||||||
dead_code,
|
dead_code,
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "air-trace"
|
name = "air-trace"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "AIR performance tracing tool"
|
description = "AIR performance tracing tool"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
|
@ -14,6 +14,18 @@
|
|||||||
* limitations under the License.
|
* 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 run;
|
||||||
mod stats;
|
mod stats;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
@ -29,9 +29,9 @@ pub(crate) struct AnomalyDataArgs {
|
|||||||
anomaly_data_path: PathBuf,
|
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_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")?;
|
serde_json::from_str(&anomaly_json).context("Failed to parse anomaly data")?;
|
||||||
|
|
||||||
let air_script = anomaly_data.air_script.to_string();
|
let air_script = anomaly_data.air_script.to_string();
|
||||||
|
@ -41,7 +41,7 @@ pub(crate) struct PlainDataArgs {
|
|||||||
data_path: PathBuf,
|
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;
|
use crate::run::load_data;
|
||||||
|
|
||||||
let air_script =
|
let air_script =
|
||||||
|
@ -73,7 +73,7 @@ impl LogRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for Message {
|
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 {
|
match self {
|
||||||
Message::New => write!(f, "new"),
|
Message::New => write!(f, "new"),
|
||||||
Message::Enter => write!(f, "enter"),
|
Message::Enter => write!(f, "enter"),
|
||||||
@ -83,7 +83,7 @@ impl std::fmt::Display for Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for CloseMessage {
|
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)
|
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 {
|
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 _;
|
use itertools::Itertools as _;
|
||||||
|
|
||||||
self.name.fmt(f)?;
|
self.name.fmt(f)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user