提交 1be35882 authored 作者: Serhij S's avatar Serhij S

codefmt

上级 b411d08f
...@@ -155,7 +155,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -155,7 +155,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
roboplc::setup_panic(); roboplc::setup_panic();
roboplc::configure_logger(roboplc::LevelFilter::Info); roboplc::configure_logger(roboplc::LevelFilter::Info);
// sets the simulated mode for the real-time module, do not set any thread real-time parameters // sets the simulated mode for the real-time module, do not set any thread real-time parameters
roboplc::thread_rt::set_simulated(); roboplc::set_simulated();
// creates a controller instance // creates a controller instance
let mut controller: Controller<Message, Variables> = Controller::new(); let mut controller: Controller<Message, Variables> = Controller::new();
// creates a reliable auto-reconnecting shared TCP port connection // creates a reliable auto-reconnecting shared TCP port connection
......
...@@ -47,6 +47,7 @@ struct VariableData { ...@@ -47,6 +47,7 @@ struct VariableData {
} }
#[derive(WorkerOpts)] #[derive(WorkerOpts)]
#[allow(clippy::struct_field_names)]
struct Worker1 { struct Worker1 {
// Modbus server context and controller variables/data hub are not synchronized automatically, // Modbus server context and controller variables/data hub are not synchronized automatically,
// workers must write to the Modbus server context and read from the controller variables/data // workers must write to the Modbus server context and read from the controller variables/data
......
...@@ -43,7 +43,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -43,7 +43,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
roboplc::setup_panic(); roboplc::setup_panic();
roboplc::configure_logger(roboplc::LevelFilter::Info); roboplc::configure_logger(roboplc::LevelFilter::Info);
if !roboplc::is_production() { if !roboplc::is_production() {
roboplc::thread_rt::set_simulated(); roboplc::set_simulated();
} }
roboplc::thread_rt::prealloc_heap(10_000_000)?; roboplc::thread_rt::prealloc_heap(10_000_000)?;
let mut controller = Controller::<Message, Variables>::new(); let mut controller = Controller::<Message, Variables>::new();
......
...@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
roboplc::setup_panic(); roboplc::setup_panic();
roboplc::configure_logger(roboplc::LevelFilter::Info); roboplc::configure_logger(roboplc::LevelFilter::Info);
if !roboplc::is_production() { if !roboplc::is_production() {
roboplc::thread_rt::set_simulated(); roboplc::set_simulated();
} }
roboplc::thread_rt::prealloc_heap(10_000_000)?; roboplc::thread_rt::prealloc_heap(10_000_000)?;
let mut controller = Controller::<Message, Variables>::new(); let mut controller = Controller::<Message, Variables>::new();
......
...@@ -176,7 +176,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -176,7 +176,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
roboplc::setup_panic(); roboplc::setup_panic();
roboplc::configure_logger(roboplc::LevelFilter::Info); roboplc::configure_logger(roboplc::LevelFilter::Info);
if !roboplc::is_production() { if !roboplc::is_production() {
roboplc::thread_rt::set_simulated(); roboplc::set_simulated();
} }
roboplc::thread_rt::prealloc_heap(10_000_000)?; roboplc::thread_rt::prealloc_heap(10_000_000)?;
let mut server = ModbusServer::bind( let mut server = ModbusServer::bind(
......
...@@ -314,6 +314,7 @@ mod test { ...@@ -314,6 +314,7 @@ mod test {
use super::Hub; use super::Hub;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[allow(dead_code)]
enum Message { enum Message {
Temperature(f64), Temperature(f64),
Humidity(f64), Humidity(f64),
......
...@@ -200,6 +200,7 @@ pub type ActionResult = std::result::Result<(), Box<dyn std::error::Error>>; ...@@ -200,6 +200,7 @@ pub type ActionResult = std::result::Result<(), Box<dyn std::error::Error>>;
type ActionHandlers<D, V> = Arc<BTreeMap<OID, ActionHandlerFn<D, V>>>; type ActionHandlers<D, V> = Arc<BTreeMap<OID, ActionHandlerFn<D, V>>>;
type BulkActionHandlers<D, V> = Arc<Vec<(OIDMask, ActionHandlerFn<D, V>)>>; type BulkActionHandlers<D, V> = Arc<Vec<(OIDMask, ActionHandlerFn<D, V>)>>;
#[allow(clippy::struct_field_names)]
struct Handlers<D, V> struct Handlers<D, V>
where where
D: DataDeliveryPolicy + Clone + Send + Sync + 'static, D: DataDeliveryPolicy + Clone + Send + Sync + 'static,
......
...@@ -12,6 +12,7 @@ enum Format { ...@@ -12,6 +12,7 @@ enum Format {
} }
impl Format { impl Format {
#[allow(clippy::unnecessary_wraps)]
fn from_path<P: AsRef<Path>>(path: P) -> Result<Self> { fn from_path<P: AsRef<Path>>(path: P) -> Result<Self> {
match path match path
.as_ref() .as_ref()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论