Skip to content

Fix cargo clippy issues and add cargo clippy to the ci #67

Description

@szabgab

Running cargo clippy on the cloned repository I get a few warnings.

  • Should I send a PR to fix those?
  • Should I send a PR to add cargo clippy to the CI to alret you when such thing happens again?
warning: you should consider adding a `Default` implementation for `TextPosition`
  --> src/common.rs:19:5
   |
19 | /     pub const fn new() -> Self {
20 | |         Self { row: 0, column: 0 }
21 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
15 + impl Default for TextPosition {
16 +     fn default() -> Self {
17 +         Self::new()
18 +     }
19 + }
   |

warning: calling .bytes() is very inefficient when data is not in memory
   --> src/util.rs:112:25
    |
112 |         let mut bytes = source.bytes();
    |                         ^^^^^^^^^^^^^^
    |
    = help: consider using `BufReader`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unbuffered_bytes
    = note: `#[warn(clippy::unbuffered_bytes)]` on by default

warning: all variants have the same prefix: `Wrote`
   --> src/writer/emitter.rs:120:1
    |
120 | / enum IndentFlags {
121 | |     WroteNothing,
122 | |     WroteMarkup,
123 | |     WroteText,
124 | | }
    | |_^
    |
    = help: remove the prefixes and use full paths to the variants instead of glob imports
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#enum_variant_names
    = note: `#[warn(clippy::enum_variant_names)]` on by default

warning: `xml` (lib) generated 3 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions