Skip to content

Commit c21f741

Browse files
Fix clippy warnings (!38)
1 parent 28c138d commit c21f741

File tree

6 files changed

+6
-47
lines changed

6 files changed

+6
-47
lines changed

src/cli/utils/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Config {
7070
fn read_default_file() -> Result<Self, CliError> {
7171
DEFAULT_CONFIG_PATHS
7272
.iter()
73-
.map(|path| Path::new(path))
73+
.map(Path::new)
7474
.filter(|path| path.exists())
7575
.find_map(|path| Some(Self::read_file(path)))
7676
.unwrap_or_else(|| Ok(Self::default()))

src/nodes/arguments.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl TupleArgumentsTokens {
2121
}
2222
}
2323

24-
#[derive(Clone, Debug, PartialEq, Eq)]
24+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
2525
pub struct TupleArguments {
2626
values: Vec<Expression>,
2727
tokens: Option<TupleArgumentsTokens>,
@@ -93,15 +93,6 @@ impl TupleArguments {
9393
}
9494
}
9595

96-
impl Default for TupleArguments {
97-
fn default() -> Self {
98-
Self {
99-
values: Vec::new(),
100-
tokens: None,
101-
}
102-
}
103-
}
104-
10596
impl From<Arguments> for TupleArguments {
10697
fn from(arguments: Arguments) -> Self {
10798
match arguments {

src/nodes/expressions/function.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl FunctionExpressionTokens {
3838
}
3939
}
4040

41-
#[derive(Clone, Debug, PartialEq, Eq)]
41+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
4242
pub struct FunctionExpression {
4343
block: Block,
4444
parameters: Vec<Identifier>,
@@ -152,14 +152,3 @@ impl FunctionExpression {
152152
}
153153
}
154154
}
155-
156-
impl Default for FunctionExpression {
157-
fn default() -> Self {
158-
Self {
159-
block: Block::default(),
160-
parameters: Vec::new(),
161-
is_variadic: false,
162-
tokens: None,
163-
}
164-
}
165-
}

src/parser.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct FunctionBodyTokens {
7575
pub variable_arguments: Option<Token>,
7676
}
7777

78-
#[derive(Clone, Debug, PartialEq, Eq)]
78+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
7979
pub struct Parser {
8080
hold_token_data: bool,
8181
}
@@ -1014,14 +1014,6 @@ impl Parser {
10141014
}
10151015
}
10161016

1017-
impl Default for Parser {
1018-
fn default() -> Self {
1019-
Self {
1020-
hold_token_data: false,
1021-
}
1022-
}
1023-
}
1024-
10251017
#[derive(Clone, Debug)]
10261018
pub enum ConvertError {
10271019
Statement {

src/process/evaluator/mod.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@ pub use lua_value::*;
55
use crate::nodes::*;
66

77
/// A struct to convert an Expression node into a LuaValue object.
8-
#[derive(Debug, Clone, PartialEq, Eq)]
8+
#[derive(Debug, Clone, Default, PartialEq, Eq)]
99
pub struct Evaluator {
1010
pure_metamethods: bool,
1111
}
1212

13-
impl Default for Evaluator {
14-
fn default() -> Self {
15-
Self {
16-
pure_metamethods: false,
17-
}
18-
}
19-
}
20-
2113
impl Evaluator {
2214
/// When evaluating expressions related to tables, this value tells the evaluator if
2315
/// metamethods can have side effects. For example, indexing a normal table in Lua does not

src/rules/empty_do.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::rules::{
66

77
use super::verify_no_rule_properties;
88

9+
#[derive(Debug, Default)]
910
struct EmptyDoFilter {
1011
mutated: bool,
1112
}
@@ -16,12 +17,6 @@ impl EmptyDoFilter {
1617
}
1718
}
1819

19-
impl Default for EmptyDoFilter {
20-
fn default() -> Self {
21-
Self { mutated: false }
22-
}
23-
}
24-
2520
impl NodeProcessor for EmptyDoFilter {
2621
fn process_block(&mut self, block: &mut Block) {
2722
block.filter_statements(|statement| match statement {

0 commit comments

Comments
 (0)