Skip to content

Conversation

RRRadicalEdward
Copy link
Collaborator

Checks the doc comments of publicly visible functions that may panic and warns if there is no # Panics section.

> Checks the doc comments of publicly visible functions that may panic and warns if there is no # Panics section.
Copy link

github-actions bot commented Oct 3, 2025

Coverage Report 🤖 ⚙️

Past:
Total lines: 26085
Covered lines: 15289 (58.61%)

New:
Total lines: 26079
Covered lines: 15285 (58.61%)

Diff: -0.00%

[this comment will be updated automatically]

@RRRadicalEdward RRRadicalEdward self-assigned this Oct 3, 2025
Comment on lines 97 to 102
Ok(u64::from_le_bytes(self.data.as_ref().try_into().map_err(|_| {
invalid_field_err!(
"requestedFileContentsData",
"Invalid data size for u64 size"
));
}

Ok(u64::from_le_bytes(
self.data
.as_ref()
.try_into()
.expect("data contains exactly eight u8 elements"),
))
"Can't cast self.data to u64 via &[u8, 8], invalid data size"
)
})?))
Copy link
Member

@CBenoit CBenoit Oct 3, 2025

Choose a reason for hiding this comment

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

suggestion: I think this is the most readable as of today:

        let chunk = self.data.first_chunk::<8>().ok_or_else(|| invalid_field_err!(
            "requestedFileContentsData",
            "not enough bytes for u64 size"
        ))?;
        Ok(u64::from_le_bytes(chunk))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it to use try_into. The way it was, but without the expect.

Comment on lines 17 to 22
/// # Panics
///
/// If log directory creation fails.
///
/// If tracing initialization fails.
pub fn init_with_env() {
Copy link
Member

Choose a reason for hiding this comment

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

issue: It’s actually not okay to panic here. Can you add a FIXME?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Does it look good?

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

Successfully merging this pull request may close these issues.

2 participants