-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add comparison_to_empty
#74
Comments
hey @Benjtalkshow wanna try this one ? |
Hey @SridharVadla45! |
sure any idea on how to proceed ? |
Hi @0xLucqs, can i try this. first i m going to identify which structs in Cairo support is_empty. Once identified, I’ll implement the logic to catch those cases and suggest fixes. Lastly, I’ll write some tests. |
Hey @BernalHQ can you pick another issue plz (or if @SridharVadla45 doesn’t answer in the coming days you can take it) |
Ok, i going to looking another issue, and i can do It, if dont answer It. |
I am applying to this issue via OnlyDust platform. My background and how it can be leveragedIve been leaning rust for the past year and looking to get a good first issue |
Hey @0xLucqs is this one available? If so, may I work on this! :D |
Hey @lauchaves! |
I am applying to this issue via OnlyDust platform. Hi @0xLucqs, is there an opportunity for me to work on this project again? I previously worked on it and would love to contribute further. |
Hey @0xLucqs, I’d love to take a look at this too. |
I am applying to this issue via OnlyDust platform. My background and how it can be leveragedI am an enthusiastic self-taught developer, that learnt Rust as my first language. With hands-on experience optimizing gas usage in projects like Node Guardians exercises (thinking in cairo, brainfvckvm). Which helped me learn how to write optimized code How I plan on tackling this issueAs I have already reviewed the codebase, I would first create a linting rule that flags these comparisons and suggests using .is_empty() instead, and then test to ensure the rule correctly identifies and suggests improvements. |
Hi @0xLucqs , please can I be assigned please? This would be my first time contributing to this repo and I’d love to be given the opportunity. |
Hey @od-hunter! |
Hey @0xLucqs |
did anyone start anything ? In case no i this issue will be paused |
Hey @0xLucqs , |
can you open a pr to show me what you have ? |
Hi @0xLucqs , can I be assigned please? This would be my first time contributing to this repository and I would love to be given this opportunity. |
Alright |
Hello @0xLucqs , I just made a draft PR regarding this issue. |
I am applying to this issue via OnlyDust platform. My background and how it can be leveragedI have experience optimizing Rust code for performance and clarity, focusing on efficient and maintainable solutions to address challenges. How I plan on tackling this issueThe check compares a slice to an empty one, recommending .is_empty() for better performance and clarity. I'd replace manual comparisons with .is_empty() to improve the code. |
What it does
Checks for comparing to an empty slice such as [], and suggests using
.is_empty()
where applicable.Why is this bad?
Some structures can answer
.is_empty()
much faster than checking for equality. So it is good to get into the habit of using.is_empty()
, and having it is cheap. Besides, it makes the intent clearer than a manual comparison in some contexts.Example
Use instead:
The text was updated successfully, but these errors were encountered: