Skip to content

Commit 01e115a

Browse files
committed
refactoring
1 parent 3811541 commit 01e115a

9 files changed

Lines changed: 92 additions & 182 deletions

File tree

crates/wireless-mbus-link-layer/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use m_bus_core::{DeviceType, Function, IdentificationNumber, ManufacturerCode};
22

33
#[cfg(feature = "std")]
4-
use std::fmt;
5-
64
#[derive(Debug, Clone, Copy, PartialEq)]
75
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
86
pub struct WirelessFrame<'a> {

examples/example_full_wired_parse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ fn main() {
99
0xCD, 0x13, 0x02, 0x27, 0x00, 0x00, 0x09, 0xFD, 0x0E, 0x02, 0x09, 0xFD, 0x0F, 0x06, 0x0F,
1010
0x00, 0x01, 0x75, 0x13, 0xD3, 0x16,
1111
];
12+
#[allow(clippy::unwrap_used)]
1213
let mbus_data = MbusData::<WiredFrame>::try_from(example.as_slice()).unwrap();
1314
println!("{:?}", mbus_data);
1415
}

examples/example_parsing_control_frame.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ fn main() {
55
0x68, 0x06, 0x06, 0x68, 0x53, 0xFE, 0x51, 0x01, 0x7A, 0x08, 0x25, 0x16,
66
];
77

8+
#[allow(clippy::unwrap_used)]
89
let frame = WiredFrame::try_from(example.as_slice()).unwrap();
910

1011
if let WiredFrame::ControlFrame {

examples/example_parsing_long_frame.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ use m_bus_parser::{Address, Function, WiredFrame};
2525
/// External Temperature (Minimum) 24.38 °C
2626
/// External Temperature (Maximum) 24.87 °C
2727
/// Averaging Duration 0 hours
28-
///
29-
// This is an example of how to use the library to parse a frame.
30-
3128
#[cfg(feature = "plaintext-before-extension")]
3229
fn main() {
3330
let example = vec![
@@ -39,6 +36,7 @@ fn main() {
3936
0xB2, 0x01, 0x65, 0x00, 0x00, 0x1F, 0xB3, 0x16,
4037
];
4138

39+
#[allow(clippy::unwrap_used)]
4240
let frame = WiredFrame::try_from(example.as_slice()).unwrap();
4341

4442
if let WiredFrame::LongFrame {

examples/example_parsing_long_frame2.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use m_bus_parser::{Address, Function, WiredFrame};
2+
23
fn main() {
34
let example = vec![
45
0x68, 0x3C, 0x3C, 0x68, 0x08, 0x08, 0x72, 0x78, 0x03, 0x49, 0x11, 0x77, 0x04, 0x0E, 0x16,
@@ -7,6 +8,8 @@ fn main() {
78
0xCD, 0x13, 0x02, 0x27, 0x00, 0x00, 0x09, 0xFD, 0x0E, 0x02, 0x09, 0xFD, 0x0F, 0x06, 0x0F,
89
0x00, 0x01, 0x75, 0x13, 0xD3, 0x16,
910
];
11+
12+
#[allow(clippy::unwrap_used)]
1013
let frame = WiredFrame::try_from(example.as_slice()).unwrap();
1114

1215
if let WiredFrame::LongFrame {

examples/example_parsing_valid_req_ud.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ fn main() {
1515
{
1616
use m_bus_parser::WiredFrame;
1717

18+
#[allow(clippy::expect_used)]
1819
let contents =
1920
fs::read_to_string(entry.path()).expect("Something went wrong reading the file");
2021
println!("Path: {}", entry.path().display());
2122
println!("Input:\n{}", contents);
2223

2324
let contents = contents.trim().replace(" ", "");
25+
#[allow(clippy::unwrap_used)]
2426
let bytes = hex::decode(contents).unwrap();
27+
#[allow(clippy::unwrap_used)]
2528
let frame = wired_mbus_link_layer::WiredFrame::try_from(bytes.as_slice()).unwrap();
2629

2730
if let WiredFrame::LongFrame {

python/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use hex;
21
use m_bus_parser::serialize_mbus_data;
32
use m_bus_parser::user_data::DataRecords;
43
use pyo3::prelude::*;
5-
use serde_json;
64

75
#[pyfunction]
86
fn parse_application_layer(data_record: &str) -> PyResult<String> {

0 commit comments

Comments
 (0)