From f386cf1e24249934a25b3e57acd814c1b60d8d71 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Wed, 20 Jul 2022 20:41:35 +0100 Subject: [PATCH] Fix clippy warnings (#501) * Fix clippy warnings * Fix * Revert --- src/cli/opt.rs | 2 +- src/context.rs | 2 +- src/formatters/expression.rs | 8 ++++---- src/formatters/general.rs | 2 +- src/lib.rs | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cli/opt.rs b/src/cli/opt.rs index e046aec1..8be0de33 100644 --- a/src/cli/opt.rs +++ b/src/cli/opt.rs @@ -92,7 +92,7 @@ pub struct Opt { pub files: Vec, } -#[derive(ArgEnum, Clone, Copy, Debug, PartialEq)] +#[derive(ArgEnum, Clone, Copy, Debug, PartialEq, Eq)] #[clap(rename_all = "PascalCase")] pub enum Color { /// Always use colour diff --git a/src/context.rs b/src/context.rs index add363f2..757c2f86 100644 --- a/src/context.rs +++ b/src/context.rs @@ -7,7 +7,7 @@ use full_moon::{ tokenizer::{Token, TokenType}, }; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum FormatNode { /// The formatting is completely blocked via an ignore comment, so this node should be skipped Skip, diff --git a/src/formatters/expression.rs b/src/formatters/expression.rs index 17493c9b..0dbfa63d 100644 --- a/src/formatters/expression.rs +++ b/src/formatters/expression.rs @@ -1043,7 +1043,7 @@ fn hang_binop_expression( ), format_expression_internal( ctx, - &*rhs, + &rhs, ExpressionContext::UnaryOrBinary, rhs_shape, ), @@ -1051,7 +1051,7 @@ fn hang_binop_expression( ExpressionSide::Right => ( format_expression_internal( ctx, - &*lhs, + &lhs, ExpressionContext::UnaryOrBinary, lhs_shape, ), @@ -1077,7 +1077,7 @@ fn hang_binop_expression( } else { format_expression_internal( ctx, - &*lhs, + &lhs, ExpressionContext::UnaryOrBinary, shape, ) @@ -1088,7 +1088,7 @@ fn hang_binop_expression( } else { format_expression_internal( ctx, - &*rhs, + &rhs, ExpressionContext::UnaryOrBinary, shape, ) diff --git a/src/formatters/general.rs b/src/formatters/general.rs index 649c3e76..b93cd048 100644 --- a/src/formatters/general.rs +++ b/src/formatters/general.rs @@ -34,7 +34,7 @@ pub enum EndTokenType { #[macro_export] macro_rules! fmt_symbol { ($ctx:expr, $token:expr, $x:expr, $shape:expr) => { - crate::formatters::general::format_symbol( + $crate::formatters::general::format_symbol( $ctx, $token, &TokenReference::symbol($x).unwrap(), diff --git a/src/lib.rs b/src/lib.rs index e608f8f2..62fc5a9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ mod shape; mod verify_ast; /// The type of indents to use when indenting -#[derive(Debug, Copy, Clone, PartialEq, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub enum IndentType { /// Indent using tabs (`\t`) @@ -27,7 +27,7 @@ impl Default for IndentType { } /// The type of line endings to use at the end of a line -#[derive(Debug, Copy, Clone, PartialEq, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub enum LineEndings { // Auto, @@ -44,7 +44,7 @@ impl Default for LineEndings { } /// The style of quotes to use within string literals -#[derive(Debug, Copy, Clone, PartialEq, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub enum QuoteStyle { /// Use double quotes where possible, but change to single quotes if it produces less escapes @@ -64,7 +64,7 @@ impl Default for QuoteStyle { } /// When to use call parentheses -#[derive(Debug, Copy, Clone, PartialEq, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub enum CallParenType { /// Use call parentheses all the time @@ -84,7 +84,7 @@ impl Default for CallParenType { } /// What mode to use if we want to collapse simple functions / guard statements -#[derive(Debug, Copy, Clone, PartialEq, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub enum CollapseSimpleStatement { /// Never collapse