Skip to content

Commit

Permalink
Refactor for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 28, 2023
1 parent 5724a9c commit af6430e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() -> Result<(), String> {
println!(
"{}",
mdxjs::compile(
r###"
r##"
import {Chart} from './snowfall.js'
export const year = 2018
Expand All @@ -17,7 +17,7 @@ It was followed by a warm spring which caused
flood conditions in many of the nearby rivers.
<Chart year={year} color="#fcb32c" />
"###,
"##,
&Default::default()
)?
);
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ The following bash scripts are useful when working on this project:
```
* format:
```sh
cargo fmt
cargo fmt && cargo clippy --examples --tests --benches --fix
```
* lint:
```sh
Expand Down
2 changes: 1 addition & 1 deletion src/mdx_plugin_recma_jsx_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl<'a> State<'a> {

// Add statements to functions.
if !statements.is_empty() {
let mut body: &mut BlockStmt = match func {
let body: &mut BlockStmt = match func {
Func::Expr(expr) => {
// Always exists if we have components in it.
expr.function.body.as_mut().unwrap()
Expand Down
12 changes: 6 additions & 6 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ fn err_expression_broken_multiline_comment_b() {
#[test]
fn err_expression_broken_multiline_comment_c() {
assert!(
matches!(compile("{/*a*/}", &Default::default()), Ok(_)),
compile("{/*a*/}", &Default::default()).is_ok(),
"should support a valid multiline comment",
);
}
Expand All @@ -367,7 +367,7 @@ fn err_expression_broken_line_comment_b() {
#[test]
fn err_expression_broken_line_comment_c() {
assert!(
matches!(compile("{//a\n}", &Default::default()), Ok(_)),
compile("{//a\n}", &Default::default()).is_ok(),
"should support a valid line comment",
);
}
Expand Down Expand Up @@ -402,15 +402,15 @@ fn err_expression_multi() {
#[test]
fn err_expression_empty() {
assert!(
matches!(compile("a {} b", &Default::default()), Ok(_)),
compile("a {} b", &Default::default()).is_ok(),
"should support an empty expression",
);
}

#[test]
fn err_expression_comment() {
assert!(
matches!(compile("a { /* b */ } c", &Default::default()), Ok(_)),
compile("a { /* b */ } c", &Default::default()).is_ok(),
"should support a comment in an empty expression",
);
}
Expand Down Expand Up @@ -445,7 +445,7 @@ fn err_expression_value_comment() {
#[test]
fn err_expression_value_extra_comment() {
assert!(
matches!(compile("<a b={1 /*c*/ } />", &Default::default()), Ok(_)),
compile("<a b={1 /*c*/ } />", &Default::default()).is_ok(),
"should support a value expression with a comment",
);
}
Expand Down Expand Up @@ -498,7 +498,7 @@ fn err_expression_spread_invalid() {
#[test]
fn err_expression_spread_extra_comment() {
assert!(
matches!(compile("<a {...b /*c*/ } />", &Default::default()), Ok(_)),
compile("<a {...b /*c*/ } />", &Default::default()).is_ok(),
"should support a spread expression with a comment",
);
}

0 comments on commit af6430e

Please sign in to comment.