Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: add better rust formatting #72

Merged
merged 3 commits into from
Jul 6, 2024

lint: relax clippy checks a bit

e3b32ae
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

lint: add better rust formatting #72

lint: relax clippy checks a bit
e3b32ae
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Jul 6, 2024 in 0s

clippy

50 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 50
Note 0
Help 0

Versions

  • rustc 1.79.0 (129f3b996 2024-06-10)
  • cargo 1.79.0 (ffa9cf99a 2024-06-03)
  • clippy 0.1.79 (129f3b9 2024-06-10)

Annotations

Check warning on line 14 in src/syntax/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/syntax/mod.rs:14:1
   |
14 | pub fn parse(text: &str) -> crate::error::Result<ast::Ast> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 35 in src/syntax/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/syntax/visitor.rs:32:5
   |
32 | /     fn visit_description(
33 | |         &mut self,
34 | |         description: &ast::Description,
35 | |     ) -> Result<Self::Output, Self::Error>;
   | |___________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 30 in src/syntax/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/syntax/visitor.rs:27:5
   |
27 | /     fn visit_action(
28 | |         &mut self,
29 | |         action: &ast::Action,
30 | |     ) -> Result<Self::Output, Self::Error>;
   | |___________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 25 in src/syntax/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/syntax/visitor.rs:22:5
   |
22 | /     fn visit_condition(
23 | |         &mut self,
24 | |         condition: &ast::Condition,
25 | |     ) -> Result<Self::Output, Self::Error>;
   | |___________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 20 in src/syntax/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/syntax/visitor.rs:17:5
   |
17 | /     fn visit_root(
18 | |         &mut self,
19 | |         root: &ast::Root,
20 | |     ) -> Result<Self::Output, Self::Error>;
   | |___________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 146 in src/syntax/tokenizer.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> src/syntax/tokenizer.rs:146:5
    |
146 |     pub fn tokenize(&mut self, text: &str) -> Result<Vec<Token>> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 117 in src/syntax/semantics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> src/syntax/semantics.rs:117:5
    |
117 |     pub fn analyze(&mut self, ast: &ast::Ast) -> Result<()> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 117 in src/syntax/semantics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
   --> src/syntax/semantics.rs:117:5
    |
117 |     pub fn analyze(&mut self, ast: &ast::Ast) -> Result<()> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/syntax/semantics.rs:118:9
    |
118 | /         match ast {
119 | |             Ast::Root(root) => self.visit_root(root),
120 | |             Ast::Condition(condition) => self.visit_condition(condition),
121 | |             Ast::Action(action) => self.visit_action(action),
...   |
127 | |         // be stored in `self.errors`.
128 | |         .unwrap();
    | |_________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 17 in src/syntax/semantics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

warning: redundant closure
  --> src/syntax/semantics.rs:17:29
   |
17 | #[error("{}", .0.iter().map(|e| e.to_string()).collect::<Vec<_>>().join(""))]
   |                             ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
   = note: `#[warn(clippy::redundant_closure_for_method_calls)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 17 in src/syntax/semantics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `.collect::<Vec<String>>().join("")` on an iterator

warning: called `.collect::<Vec<String>>().join("")` on an iterator
  --> src/syntax/semantics.rs:17:48
   |
17 | #[error("{}", .0.iter().map(|e| e.to_string()).collect::<Vec<_>>().join(""))]
   |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `collect::<String>()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
   = note: `#[warn(clippy::unnecessary_join)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 130 in src/syntax/parser.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> src/syntax/parser.rs:130:5
    |
130 |     pub fn parse(&mut self, text: &str, tokens: &[Token]) -> Result<Ast> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 148 in src/scaffold/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> src/scaffold/mod.rs:148:1
    |
148 | pub fn scaffold(text: &str, cfg: &Config) -> crate::error::Result<String> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 148 in src/scaffold/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
   --> src/scaffold/mod.rs:148:1
    |
148 | pub fn scaffold(text: &str, cfg: &Config) -> crate::error::Result<String> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/scaffold/mod.rs:153:9
    |
153 |         fmt(&source).expect("should format the emitted solidity code");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 58 in src/scaffold/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

more than 3 bools in a struct

warning: more than 3 bools in a struct
  --> src/scaffold/mod.rs:26:1
   |
26 | / pub struct Scaffold {
27 | |     /// The set of tree files to generate from.
28 | |     ///
29 | |     /// Each Solidity file will be named after its matching
...  |
57 | |     pub skip_modifiers: bool,
58 | | }
   | |_^
   |
   = help: consider using a state machine or refactoring bools into two-variant enums
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#struct_excessive_bools
   = note: `#[warn(clippy::struct_excessive_bools)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 42 in src/scaffold/modifiers.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
  --> src/scaffold/modifiers.rs:42:5
   |
42 |     pub fn discover(&mut self, ast: &Ast) -> &IndexMap<String, String> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/scaffold/modifiers.rs:45:17
   |
45 |                 self.visit_root(root).unwrap();
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 91 in src/scaffold/emitter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `self` argument

warning: unused `self` argument
  --> src/scaffold/emitter.rs:91:9
   |
91 |         &self,
   |         ^^^^^
   |
   = help: consider refactoring to an associated function
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
   = note: `#[warn(clippy::unused_self)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 47 in src/hir/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

item name ends with its containing module's name

warning: item name ends with its containing module's name
  --> src/hir/mod.rs:47:8
   |
47 | pub fn translate_tree_to_hir(tree: &str, cfg: &Config) -> error::Result<Hir> {
   |        ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `#[warn(clippy::module_name_repetitions)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 47 in src/hir/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/mod.rs:47:1
   |
47 | pub fn translate_tree_to_hir(tree: &str, cfg: &Config) -> error::Result<Hir> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 22 in src/hir/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/mod.rs:22:1
   |
22 | pub fn translate(text: &str, cfg: &Config) -> anyhow::Result<Hir> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 85 in src/hir/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/visitor.rs:82:5
   |
82 | /     fn visit_statement(
83 | |         &mut self,
84 | |         statement: &hir::Statement,
85 | |     ) -> Result<Self::StatementOutput, Self::Error>;
   | |____________________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 73 in src/hir/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/visitor.rs:70:5
   |
70 | /     fn visit_comment(
71 | |         &mut self,
72 | |         comment: &hir::Comment,
73 | |     ) -> Result<Self::CommentOutput, Self::Error>;
   | |__________________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 59 in src/hir/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/visitor.rs:56:5
   |
56 | /     fn visit_function(
57 | |         &mut self,
58 | |         function: &hir::FunctionDefinition,
59 | |     ) -> Result<Self::FunctionDefinitionOutput, Self::Error>;
   | |_____________________________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 47 in src/hir/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/visitor.rs:44:5
   |
44 | /     fn visit_contract(
45 | |         &mut self,
46 | |         contract: &hir::ContractDefinition,
47 | |     ) -> Result<Self::ContractDefinitionOutput, Self::Error>;
   | |_____________________________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 35 in src/hir/visitor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/visitor.rs:32:5
   |
32 | /     fn visit_root(
33 | |         &mut self,
34 | |         root: &hir::Root,
35 | |     ) -> Result<Self::RootOutput, Self::Error>;
   | |_______________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 98 in src/hir/combiner.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/hir/combiner.rs:98:5
   |
98 |     pub fn combine(self, text: &str, hirs: Vec<Hir>) -> Result<Hir> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc