Unverified Commit d0fbe8b2 by Enkelmann Committed by GitHub

add GitHub actions for Rustfmt and clippy (#125)

parent d3dde7d7
name: codestyle-checks
on: [push]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D clippy::all
\ No newline at end of file
......@@ -198,7 +198,7 @@ fn filter_modules_for_partial_run(
.filter_map(|module_name| {
if let Some(module) = modules.iter().find(|module| module.name == module_name) {
Some(*module)
} else if module_name == "" {
} else if module_name.is_empty() {
None
} else {
panic!("Error: {} is not a valid module name.", module_name)
......
......@@ -67,7 +67,7 @@ impl<'a> Context<'a> {
}
/// If `result` is an `Err`, log the error message as a debug message through the `log_collector` channel.
pub fn log_debug<'_lt>(&self, result: Result<(), Error>, location: Option<&'_lt Tid>) {
pub fn log_debug(&self, result: Result<(), Error>, location: Option<&Tid>) {
if let Err(err) = result {
let mut log_message =
LogMessage::new_debug(format!("{}", err)).source("Pointer Inference");
......
......@@ -5,7 +5,6 @@ use crate::prelude::*;
use derive_more::Deref;
use serde::{Deserialize, Serialize};
use std::collections::BTreeSet;
use std::iter::FromIterator;
use std::ops::DerefMut;
use std::sync::Arc;
......@@ -271,9 +270,9 @@ impl AbstractObjectInfo {
.map(|(index, value)| (format!("{}", index), value.to_json_compact()));
elements.push((
"memory".to_string(),
serde_json::Value::Object(serde_json::Map::from_iter(memory)),
serde_json::Value::Object(memory.collect()),
));
serde_json::Value::Object(serde_json::Map::from_iter(elements.into_iter()))
serde_json::Value::Object(elements.into_iter().collect())
}
}
......
......@@ -343,7 +343,7 @@ impl From<Expression> for IrExpression {
} else if width % 8 == 0 {
IrExpression::Subpiece {
arg: Box::new(IrExpression::from(*arg)),
low_byte: (0 as u64).into(),
low_byte: (0u64).into(),
size: width.into(),
}
} else {
......
......@@ -21,7 +21,6 @@ external to_string: serde_json -> string = "rs_convert_json_to_string"
use super::OcamlSendable;
use ocaml::{FromValue, ToValue};
use std::iter::FromIterator;
use std::rc::Rc;
use std::str::FromStr;
......@@ -61,12 +60,15 @@ impl From<&JsonBuilder> for serde_json::Value {
.map(|rc_elem| serde_json::Value::from(&**rc_elem))
.collect(),
JsonBuilder::Object(tuple_vec) => serde_json::Value::Object(
serde_json::Map::from_iter(tuple_vec.iter().map(|(string_ref, json_builder)| {
tuple_vec
.iter()
.map(|(string_ref, json_builder)| {
(
string_ref.to_string(),
serde_json::Value::from(&**json_builder),
)
})),
})
.collect(),
),
}
}
......
......@@ -288,10 +288,7 @@ impl ExternSymbol {
/// Get the calling convention corresponding to the extern symbol.
pub fn get_calling_convention<'a>(&self, project: &'a Project) -> &'a CallingConvention {
let cconv_name = match self.calling_convention {
Some(ref name) => name,
None => "default",
};
let cconv_name: &str = self.calling_convention.as_deref().unwrap_or("default");
project
.calling_conventions
.iter()
......
......@@ -94,7 +94,7 @@ impl Variable {
input0: None,
input1: Some(Variable::new_const(
self.address.as_ref().unwrap(),
ByteSize::from(0 as u64), // We do not know the correct pointer size here.
ByteSize::from(0u64), // We do not know the correct pointer size here.
)),
input2: None,
},
......
......@@ -175,7 +175,7 @@ impl Def {
pub fn correct_pointer_sizes(&mut self, pointer_size: ByteSize) {
if self.rhs.mnemonic == ExpressionType::LOAD {
let input1 = self.rhs.input1.as_mut().unwrap();
if input1.size == ByteSize::from(0 as u64) {
if input1.size == ByteSize::from(0u64) {
input1.size = pointer_size;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment