Skip to content

derive(Debug) in most places.#40

Merged
Narsil merged 4 commits into
huggingface:mainfrom
MarcusDunn:derive_debug
Feb 2, 2024
Merged

derive(Debug) in most places.#40
Narsil merged 4 commits into
huggingface:mainfrom
MarcusDunn:derive_debug

Conversation

@MarcusDunn

Copy link
Copy Markdown
Contributor

This started as wanting to debug print a Repo. It turned into

  • Derive Debug on nearly everything
  • remove unused Result on build_headers
  • rename file1 to file in create_ref
  • two spelling fixes (buids -> builds, interacto -> interact)
  • change if + panic! into an assert_eq! in make_relative (this seems like a bug? I think the assertion is supposed to check both paths are absolute - it currently accepts if both are not absolute paths. I left behavior unchanged)
  • added semicolons where the expression was unused.

At one point I had must_use strewn around after a clippy fix but I decided to remove them to keep consistent with current practices.

@Narsil Narsil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I kind of prefer if !xx.empty() { Some() } else {None} just because it feels easier to have the happy path first in my mind (unless you use the unhappy paths for early returns + deindent.

make_relative was taken from somewhere on stackoverflow, ideally I'd replace the panic with a proper error but since it's internal it shouldn't make a big difference.

Thanks for the patch!

@Narsil

Narsil commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

Merging this as-is, we can make follow-ups if you want to change the panic into a Result.

@Narsil Narsil merged commit 6303587 into huggingface:main Feb 2, 2024
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

Successfully merging this pull request may close these issues.

2 participants