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

CI : add lint and formater #35

Open
mtb0x1 opened this issue Sep 5, 2024 · 1 comment
Open

CI : add lint and formater #35

mtb0x1 opened this issue Sep 5, 2024 · 1 comment

Comments

@mtb0x1
Copy link

mtb0x1 commented Sep 5, 2024

Consider adding clippy and fmt steps to CI on push.
There is a long list of warring, some are a bit noisy and other might point to a potential issues.

I can take this if needed.

Some examples:

warning: this `if` has identical blocks
   --> src/cmd/include.rs:290:52
    |
290 |             let iostandard = if port_name == "clk" { "LVCMOS33" } else { "LVCMOS33" };
    |                                                    ^^^^^^^^^^^^^^
    |
note: same as this
   --> src/cmd/include.rs:290:72
    |
290 |             let iostandard = if port_name == "clk" { "LVCMOS33" } else { "LVCMOS33" };
    |                                                                        ^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
    = note: `#[warn(clippy::if_same_then_else)]` on by default
warning: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
   --> src/cmd/include.rs:549:31
    |
549 | fn update_lockfile(full_path: &PathBuf, url: &str, contents: &str, visited: &HashSet<String>, is_top_module: bool) -> Result<()> {
    |                               ^^^^^^^^ help: change this to: `&Path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
warning: useless use of `format!`
   --> src/cmd/include.rs:300:31
    |
300 |         xdc_content.push_str(&format!("create_clock -period 10.000 -name sys_clk_pin -waveform {{0.000 5.000}} -add [get_ports {{ clk }}]\n"));
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"create_clock -period 10.000 -name sys_clk_pin -waveform {0.000 5.000} -add [get_ports { clk }]\n".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
@sathvikr
Copy link
Contributor

sathvikr commented Sep 5, 2024

That would help a lot! Thanks for offering to take it. Will also ensure that warnings are minimized, but it would help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants