Skip to content

Commit 6029bff

Browse files
committed
Fix warnings from latest version of clippy.
1 parent c9319cc commit 6029bff

File tree

4 files changed

+12
-101
lines changed

4 files changed

+12
-101
lines changed

frame_runtime/src/smcat.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::fmt;
1616
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#colors-and-line-width>
1717
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#state-display-names>
1818
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#overriding-the-type-of-a-state>
19-
#[derive(Clone, Debug, PartialEq, Eq)]
19+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
2020
pub struct NodeStyle {
2121
pub active: bool,
2222
pub class: Option<String>,
@@ -31,37 +31,14 @@ pub struct NodeStyle {
3131
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#classes>
3232
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#colors-and-line-width>
3333
/// * <https://github.com/sverweij/state-machine-cat/blob/develop/README.md#internal-and-external-transitions>
34-
#[derive(Clone, Debug, PartialEq)]
34+
#[derive(Clone, Debug, Default, PartialEq)]
3535
pub struct EdgeStyle {
3636
pub class: Option<String>,
3737
pub color: Option<String>,
3838
pub etype: Option<String>,
3939
pub width: Option<f32>,
4040
}
4141

42-
impl Default for NodeStyle {
43-
fn default() -> Self {
44-
NodeStyle {
45-
active: false,
46-
class: None,
47-
color: None,
48-
label: None,
49-
ntype: None,
50-
}
51-
}
52-
}
53-
54-
impl Default for EdgeStyle {
55-
fn default() -> Self {
56-
EdgeStyle {
57-
class: None,
58-
color: None,
59-
etype: None,
60-
width: None,
61-
}
62-
}
63-
}
64-
6542
impl fmt::Display for NodeStyle {
6643
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
6744
let mut parts = Vec::new();

framec/src/frame_c/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ impl NodeElement for LiteralExprNode {
15121512

15131513
#[derive(Clone)]
15141514
pub struct TypeNode {
1515+
#[allow(dead_code)]
15151516
is_superstring: bool,
15161517
is_reference: bool,
15171518
type_str: String,

framec/src/frame_c/config.rs

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::fs;
99
use std::path::PathBuf;
1010

1111
/// The root struct of a frame configuration.
12-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
12+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
1313
pub struct FrameConfig {
1414
pub codegen: CodeGenConfig,
1515
}
@@ -48,30 +48,30 @@ impl FrameConfig {
4848
}
4949

5050
/// Configuration options related to code generation.
51-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
51+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
5252
pub struct CodeGenConfig {
5353
pub common: CommonConfig,
5454
pub rust: RustConfig,
5555
pub smcat: SmcatConfig,
5656
}
5757

5858
/// Code generation options shared among all backends.
59-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
59+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
6060
pub struct CommonConfig {
6161
pub features: CommonFeatures,
6262
pub code: CommonCode,
6363
}
6464

6565
/// Code generation features shared among all backends.
66-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
66+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
6767
pub struct CommonFeatures {}
6868

6969
/// Naming options for generated code shared among all backends.
70-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
70+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
7171
pub struct CommonCode {}
7272

7373
/// Code generation options specific to the Rust backend.
74-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
74+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
7575
pub struct RustConfig {
7676
pub features: RustFeatures,
7777
pub code: RustCode,
@@ -222,14 +222,14 @@ impl RustRuntime {
222222
}
223223

224224
/// Code generation options specific to the Smcat backend.
225-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
225+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
226226
pub struct SmcatConfig {
227227
pub features: SmcatFeatures,
228228
pub code: SmcatCode,
229229
}
230230

231231
/// Code generation features specific to the Smcat backend.
232-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
232+
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
233233
pub struct SmcatFeatures {}
234234

235235
/// Style options for generated code specific to the Smcat backend.
@@ -365,55 +365,6 @@ impl Provider for SystemNode {
365365

366366
// Defaults
367367

368-
impl Default for FrameConfig {
369-
fn default() -> Self {
370-
FrameConfig {
371-
codegen: CodeGenConfig::default(),
372-
}
373-
}
374-
}
375-
376-
impl Default for CodeGenConfig {
377-
fn default() -> Self {
378-
CodeGenConfig {
379-
common: CommonConfig::default(),
380-
rust: RustConfig::default(),
381-
smcat: SmcatConfig::default(),
382-
}
383-
}
384-
}
385-
386-
impl Default for CommonConfig {
387-
fn default() -> Self {
388-
CommonConfig {
389-
features: CommonFeatures::default(),
390-
code: CommonCode::default(),
391-
}
392-
}
393-
}
394-
395-
impl Default for CommonFeatures {
396-
fn default() -> Self {
397-
CommonFeatures {}
398-
}
399-
}
400-
401-
impl Default for CommonCode {
402-
fn default() -> Self {
403-
CommonCode {}
404-
}
405-
}
406-
407-
impl Default for RustConfig {
408-
fn default() -> Self {
409-
RustConfig {
410-
features: RustFeatures::default(),
411-
code: RustCode::default(),
412-
runtime: RustRuntime::default(),
413-
}
414-
}
415-
}
416-
417368
impl Default for RustFeatures {
418369
fn default() -> Self {
419370
RustFeatures {
@@ -504,21 +455,6 @@ impl Default for RustRuntime {
504455
}
505456
}
506457

507-
impl Default for SmcatConfig {
508-
fn default() -> Self {
509-
SmcatConfig {
510-
features: SmcatFeatures::default(),
511-
code: SmcatCode::default(),
512-
}
513-
}
514-
}
515-
516-
impl Default for SmcatFeatures {
517-
fn default() -> Self {
518-
SmcatFeatures {}
519-
}
520-
}
521-
522458
impl Default for SmcatCode {
523459
fn default() -> Self {
524460
SmcatCode {

framec/src/frame_c/symbol_table.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,10 +1146,7 @@ impl Arcanum {
11461146
}
11471147
let system_symbol_rcref = self.system_symbol_opt.as_ref().unwrap();
11481148
let system_symbol = system_symbol_rcref.borrow_mut();
1149-
system_symbol
1150-
.events
1151-
.get(&cannonical_msg)
1152-
.map(|x| Rc::clone(x))
1149+
system_symbol.events.get(&cannonical_msg).map(Rc::clone)
11531150
}
11541151

11551152
// pub fn get_event_ret_opt(&mut self, msg:&str, state_name_opt:&Option<String>) -> Option<TypeNode> {

0 commit comments

Comments
 (0)