Skip to content
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

usage of cargo clippy --fix --lib -p usvg with rust 1.83.0 #876

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mothsART
Copy link

Pull requests that include:

  • clippy fixes

@mothsART mothsART force-pushed the feature/cargo-clippy branch from f07d790 to f943fe3 Compare December 28, 2024 15:36
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

A lot of these changes are at best marginal

Comment on lines 57 to +60
clip_path = convert(link, state, object_bbox, cache);

// Linked `clipPath` must be valid.
if clip_path.is_none() {
return None;
}
clip_path.as_ref()?;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is better. If you do want to change this, I'd say:

// Bail out if the linked clip path is invalid
let clip_path_attr = convert(...)?;
clip_path = Some(clip_path_attr);

But I think the original code is fine...

@@ -331,7 +331,7 @@ fn convert_stops(grad: SvgNode) -> Vec<Stop> {
if stops.len() >= 3 {
let mut i = 0;
while i < stops.len() - 2 {
let offset1 = stops[i + 0].offset.get();
let offset1 = stops[i].offset.get();
Copy link
Member

Choose a reason for hiding this comment

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

Again... I can see the rationale, but I think the previous version was probably better.

@@ -1418,7 +1418,7 @@ fn shape_text_with_font(

glyphs.push(Glyph {
byte_idx: ByteIndex::new(idx),
cluster_len: end.checked_sub(start).unwrap_or(0), // TODO: can fail?
cluster_len: end.saturating_sub(start), // TODO: can fail?
Copy link
Member

Choose a reason for hiding this comment

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

The semantics are the same, but the meaning this suggests to the reader is different

@LaurenzV
Copy link
Contributor

LaurenzV commented Jan 6, 2025

A lot of these changes are at best marginal

My understanding was that all of these are changes automatically applied by clippy, no? 😄 In which case we probably would have to adapt which lints we want to have.

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.

3 participants