You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #98, Result is returned in a lot of new places. These functions should probably document when errors can occur, and why.
According to clippy's missing_errors_doc lint, "Documenting the type of errors that can be returned from a function can help callers write code to handle the errors appropriately." It suggests doing this with a /// # Errors section in the rustdoc comments. I suggest following this suggestion.
Background: I just upgraded to syntect 5.0.0, and I got a warning that HighlightLines::highlight had been "renamed" to HighlightLines::highlight_line. However, when I changed the function name, I noticed that the new function returned a Result, unlike the old function, and it wasn't readily apparent why. I checked the documentation to see if there were any new failure states, but didn't find any documentation. Only by checking the source code did I learn that the old function would panic, but I still don't know what could cause that to happen.
(Note that missing_panics_doc is a similar lint for panics, which also would have helped in this case, although I understand syntect has eliminated most/all panics by now.)
The text was updated successfully, but these errors were encountered:
After #98,
Result
is returned in a lot of new places. These functions should probably document when errors can occur, and why.According to clippy's
missing_errors_doc
lint, "Documenting the type of errors that can be returned from a function can help callers write code to handle the errors appropriately." It suggests doing this with a/// # Errors
section in the rustdoc comments. I suggest following this suggestion.Background: I just upgraded to syntect 5.0.0, and I got a warning that
HighlightLines::highlight
had been "renamed" toHighlightLines::highlight_line
. However, when I changed the function name, I noticed that the new function returned aResult
, unlike the old function, and it wasn't readily apparent why. I checked the documentation to see if there were any new failure states, but didn't find any documentation. Only by checking the source code did I learn that the old function would panic, but I still don't know what could cause that to happen.(Note that
missing_panics_doc
is a similar lint for panics, which also would have helped in this case, although I understand syntect has eliminated most/all panics by now.)The text was updated successfully, but these errors were encountered: