aslilac / kc

Kayla's (line) counter (of code) :)
Mozilla Public License 2.0
26 stars 2 forks source link

Don't die when dir is empty or has no recognized lang files #1

Closed adz closed 2 years ago

adz commented 2 years ago

Hello!

I (perhaps) fixed a little bug where the .unwrap() can be None when returning total_lines. Happened for me when I ran in my projects folder when this repo was checked out in it: https://github.com/adz/xps9360 - i think nothing in there is recognized, and skipped maybe?

Anyway, I do not know Rust at all aside from reading 1/2 the tutorial, but had a go at it!

aslilac commented 2 years ago

Sorry for taking so long to get around to this. I opted to fix it a slightly different way (because .unwrap_or(0) can just lead to a divide by zero error instead), but I still very much appreciate the PR. :)

adz commented 2 years ago

That's fantastic. Thanks! I'll check out how you solved it to improve my rust.

On Wed, 28 Sep 2022, 7:14 am Kayla Washburn, @.***> wrote:

sorry for taking so long to get around to this. I opted to fix it a slightly different way (because .unwrap_or(0) can just lead to a divide by zero error instead), but I still very much appreciate the pr. :)

— Reply to this email directly, view it on GitHub https://github.com/aslilac/kc/pull/1#issuecomment-1260086476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKBDJIQBDSXI3JJNWJHATWANTDHANCNFSM6AAAAAAQC4E6JU . You are receiving this because you authored the thread.Message ID: @.***>