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

[Merged by Bors] - fix diagnostic length for asset count #2165

Closed
wants to merge 2 commits into from

Conversation

mockersf
Copy link
Member

fixes #2156
limit the diagnostic name to MAX_DIAGNOSTIC_NAME_WIDTH length

@NathanSWard
Copy link
Contributor

NathanSWard commented May 14, 2021

Please correct me if I'm wrong, but the length of the string is still capped at 32, correct? So this won't actually change any of the behavior from the first problem #2156 mentioned.

Edit: oh, now I see the additional logic for the asset names!

Comment on lines +22 to +24
/// The width which diagnostic names will be printed as
/// Plugin names should not be longer than this value
pub const MAX_DIAGNOSTIC_NAME_WIDTH: usize = 32;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of having this limit in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

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

it came in #1505

Copy link
Member Author

Choose a reason for hiding this comment

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

it was to clean up how it's displayed, and it's an issue only for this diagnostics as all other have a fixed name

if asset_type_name.len() > max_length {
asset_type_name
.split_at(asset_type_name.len() - max_length + 1)
.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.1
.0

This should be the first &str returned by split_at (assuming you want the first part of the type name).

Copy link
Member Author

Choose a reason for hiding this comment

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

I want the second, the first is most likely to be part of the path: asset_count bevy_render::texture::texture::Texture

@cart
Copy link
Member

cart commented May 14, 2021

Looks good to me!

@cart
Copy link
Member

cart commented May 14, 2021

bors r+

bors bot pushed a commit that referenced this pull request May 14, 2021
fixes #2156 
limit the diagnostic name to `MAX_DIAGNOSTIC_NAME_WIDTH` length
@bors bors bot changed the title fix diagnostic length for asset count [Merged by Bors] - fix diagnostic length for asset count May 14, 2021
@bors bors bot closed this May 14, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
fixes bevyengine#2156 
limit the diagnostic name to `MAX_DIAGNOSTIC_NAME_WIDTH` length
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.

Multiple issues when using AssetCountDiagnosticPlugin
3 participants