ronantakizawa/codereview-bench huggingface dataset:
Repository: bevyengine/bevy
File: crates/bevy_ecs/src/schedule/set.rs (Rust)

Code before:
        }
    }
);

/// A shorthand for `Interned<dyn SystemSet>`.
pub type InternedSystemSet = Interned<dyn SystemSet>;
/// A shorthand for `Interned<dyn ScheduleLabel>`.
pub type InternedScheduleLabel = Interned<dyn ScheduleLabel>;

/// A [`SystemSet`] grouping instances of the same function.
///
/// This kind of set is automatically populated and thus has some special rules:
/// - You cannot manually add members.
/// - You cannot configure them.
/// - You cannot order something relative to one if it has more than one member.
pub struct SystemTypeSet<T: 'static>(PhantomData<fn() -> T>);

impl<T: 'static> SystemTypeSet<T> {
    pub(crate) fn new() -> Self {
        Self(PhantomData)
    }
}

impl<T> Debug for SystemTypeSet<T> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        f.debug_tuple("SystemTypeSet")
            .field(&format_args!("fn {}()", DebugName::type_name::<T>()))
            .finish()
    }
}

impl<T> Hash for SystemTypeSet<T> {
    fn hash<H: Hasher>(&self, _state: &mut H) {
        // all systems of a given type are the same
    }
}

impl<T> Clone for SystemTypeSet<T> {
    fn clone(&self) -> Self {
        *self
    }
}

impl<T> Copy for SystemTypeSet<T> {}

impl<T> PartialEq for SystemTypeSet<T> {
    #[inline]
    fn eq(&self, _other: &Self) -> bool {
        // all systems of a given type are the same
        true
    }

Review comment (bug):
As long as you're simplifying the display, do you want to use `ShortName` here to shorten `bevy_dev_tools::schedule_data::serde::tests::linear::a` to `a`?  

```suggestion
        write!(f, "SystemTypeSet:{}", DebugName::type_name::<T>().shortname())
```

Code after:
        }
    }
);

/// A shorthand for `Interned<dyn SystemSet>`.
pub type InternedSystemSet = Interned<dyn SystemSet>;
/// A shorthand for `Interned<dyn ScheduleLabel>`.
pub type InternedScheduleLabel = Interned<dyn ScheduleLabel>;

/// A [`SystemSet`] grouping instances of the same function.
///
/// This kind of set is automatically populated and thus has some special rules:
/// - You cannot manually add members.
/// - You cannot configure them.
/// - You cannot order something relative to one if it has more than one member.
pub struct SystemTypeSet<T: 'static>(PhantomData<fn() -> T>);

impl<T: 'static> SystemTypeSet<T> {
    pub(crate) fn new() -> Self {
        Self(PhantomData)
    }
}

impl<T> Debug for SystemTypeSet<T> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "SystemTypeSet:{}", DebugName::type_name::<T>())
    }
}

impl<T> Hash for SystemTypeSet<T> {
    fn hash<H: Hasher>(&self, _state: &mut H) {
        // all systems of a given type are the same
    }
}

impl<T> Clone for SystemTypeSet<T> {
    fn clone(&self) -> Self {
        *self
    }
}

impl<T> Copy for SystemTypeSet<T> {}

impl<T> PartialEq for SystemTypeSet<T> {
    #[inline]
    fn eq(&self, _other: &Self) -> bool {
        // all systems of a given type are the same
        true
    }
}
Repository: bevyengine/bevy
File: examples/ui/image_node.rs (Rust)

Code before:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // root node for center image which is in child node
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}


Review comment (suggestion):
I just want to be a little more informative here:
```suggestion
        // This root Node serves as a container for the ImageNode. 
        // In this case, it will center the item on the screen.  
```

Code after:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // Ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // This root Node serves as a container for the ImageNode.
        // In this case, it will center the item on the screen.
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        // Child Nodes are added with the `children!` macro.
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}
Repository: bevyengine/bevy
File: examples/ui/image_node.rs (Rust)

Code before:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // root node for center image which is in child node
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}


Review comment (suggestion):
and a little more informative here as well.
```suggestion
        },
        // Child Nodes are added with the `children!` macro.
```

Code after:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // Ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // This root Node serves as a container for the ImageNode.
        // In this case, it will center the item on the screen.
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        // Child Nodes are added with the `children!` macro.
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}
Repository: bevyengine/bevy
File: examples/ui/image_node.rs (Rust)

Code before:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // root node for center image which is in child node
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}


Review comment (suggestion):
This one is super nitpicky
```suggestion
    // UI camera
```

Code after:
//! This example illustrates the basic usage of an `ImageNode`.
//! `ImageNode` is UI Node that render an Image.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // Ui camera
    commands.spawn(Camera2d);

    commands.spawn((
        // This root Node serves as a container for the ImageNode.
        // In this case, it will center the item on the screen.
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
            ..default()
        },
        // Child Nodes are added with the `children!` macro.
        children![(
            // Create a new `ImageNode` with the given texture.
            ImageNode::new(asset_server.load("branding/icon.png")),
            // Child Node control `ImageNode` size
            Node {
                width: Val::Px(256.),
                height: Val::Px(256.),
                ..default()
            }
        )],
    ));
}
Repository: bevyengine/bevy
File: examples/ui/image_node_resizing.rs (Rust)

Code before:

// Text data for easy modification
#[derive(Debug, Component)]
struct TextData {
    height: f32,
    width: f32,
}

#[derive(Debug)]
enum Direction {
    Height,
    Width,
}

#[derive(Debug, EntityEvent)]
struct TextUpdate {
    entity: Entity,
    direction: Direction,
    change: f32,
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}, width : {}",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_WIDTH, IMAGE_GROUP_BOX_INIT_HEIGHT
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_WIDTH,
                width: IMAGE_GROUP_BOX_INIT_HEIGHT,
            },
            Text::new(full_text),

Review comment (suggestion):
Looks like the ordering should be switched here
```suggestion
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_HEIGHT, IMAGE_GROUP_BOX_INIT_WIDTH, 
```

Code after:

// Text data for easy modification
#[derive(Debug, Component)]
struct TextData {
    height: f32,
    width: f32,
}

#[derive(Debug)]
enum Direction {
    Height,
    Width,
}

#[derive(Debug, EntityEvent)]
struct TextUpdate {
    entity: Entity,
    direction: Direction,
    change: f32,
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}%, width : {}%",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_HEIGHT, IMAGE_GROUP_BOX_INIT_WIDTH,
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_HEIGHT,
                width: IMAGE_GROUP_BOX_INIT_WIDTH,
            },
            Text::new(full_text),
Repository: bevyengine/bevy
File: examples/ui/image_node_resizing.rs (Rust)

Code before:
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}, width : {}",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_WIDTH, IMAGE_GROUP_BOX_INIT_HEIGHT
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_WIDTH,
                width: IMAGE_GROUP_BOX_INIT_HEIGHT,
            },
            Text::new(full_text),
            TextColor::BLACK,
            Node {
                grid_row: GridPlacement::span(1),
                padding: UiRect::all(px(6)),
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            ChildOf(container),
        ))
        .observe(update_text);

    commands
        .spawn((
            Node {
                display: Display::Flex,
                grid_row: GridPlacement::span(1),
                flex_direction: FlexDirection::Column,
                justify_content: JustifyContent::SpaceAround,
                padding: UiRect::all(Val::Px(10.)),

Review comment (suggestion):
```suggestion
                height: IMAGE_GROUP_BOX_INIT_HEIGHT,
```

Code after:
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}%, width : {}%",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_HEIGHT, IMAGE_GROUP_BOX_INIT_WIDTH,
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_HEIGHT,
                width: IMAGE_GROUP_BOX_INIT_WIDTH,
            },
            Text::new(full_text),
            TextColor::BLACK,
            Node {
                grid_row: GridPlacement::span(1),
                padding: UiRect::all(px(6)),
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            ChildOf(container),
        ))
        .observe(update_text);

    commands
        .spawn((
            Node {
                display: Display::Flex,
Repository: bevyengine/bevy
File: examples/ui/image_node_resizing.rs (Rust)

Code before:
    let full_text = format!(
        "{}height : {}, width : {}",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_WIDTH, IMAGE_GROUP_BOX_INIT_HEIGHT
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_WIDTH,
                width: IMAGE_GROUP_BOX_INIT_HEIGHT,
            },
            Text::new(full_text),
            TextColor::BLACK,
            Node {
                grid_row: GridPlacement::span(1),
                padding: UiRect::all(px(6)),
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            ChildOf(container),
        ))
        .observe(update_text);

    commands
        .spawn((
            Node {
                display: Display::Flex,
                grid_row: GridPlacement::span(1),
                flex_direction: FlexDirection::Column,
                justify_content: JustifyContent::SpaceAround,
                padding: UiRect::all(Val::Px(10.)),
                ..default()

Review comment (suggestion):
```suggestion
                width: IMAGE_GROUP_BOX_INIT_WIDTH,
```

Code after:
    let full_text = format!(
        "{}height : {}%, width : {}%",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_HEIGHT, IMAGE_GROUP_BOX_INIT_WIDTH,
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_HEIGHT,
                width: IMAGE_GROUP_BOX_INIT_WIDTH,
            },
            Text::new(full_text),
            TextColor::BLACK,
            Node {
                grid_row: GridPlacement::span(1),
                padding: UiRect::all(px(6)),
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            UiDebugOptions {
                enabled: false,
                ..default()
            },
            ChildOf(container),
        ))
        .observe(update_text);

    commands
        .spawn((
            Node {
                display: Display::Flex,
                grid_row: GridPlacement::span(1),
Repository: bevyengine/bevy
File: examples/ui/image_node_resizing.rs (Rust)

Code before:
}

// Text data for easy modification
#[derive(Debug, Component)]
struct TextData {
    height: f32,
    width: f32,
}

#[derive(Debug)]
enum Direction {
    Height,
    Width,
}

#[derive(Debug, EntityEvent)]
struct TextUpdate {
    entity: Entity,
    direction: Direction,
    change: f32,
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}, width : {}",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_WIDTH, IMAGE_GROUP_BOX_INIT_HEIGHT
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_WIDTH,
                width: IMAGE_GROUP_BOX_INIT_HEIGHT,
            },

Review comment (suggestion):
```suggestion
        "{}height : {}%, width : {}%",
```

Code after:
}

// Text data for easy modification
#[derive(Debug, Component)]
struct TextData {
    height: f32,
    width: f32,
}

#[derive(Debug)]
enum Direction {
    Height,
    Width,
}

#[derive(Debug, EntityEvent)]
struct TextUpdate {
    entity: Entity,
    direction: Direction,
    change: f32,
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let image_handle = asset_server.load("branding/icon.png");
    let full_text = format!(
        "{}height : {}%, width : {}%",
        TEXT_PREFIX, IMAGE_GROUP_BOX_INIT_HEIGHT, IMAGE_GROUP_BOX_INIT_WIDTH,
    );

    commands.spawn(Camera2d);

    let container = commands
        .spawn((
            Node {
                display: Display::Grid,
                width: percent(100),
                height: percent(100),
                grid_template_rows: vec![GridTrack::min_content(), GridTrack::flex(1.0)],
                ..default()
            },
            BackgroundColor(Color::WHITE),
        ))
        .id();

    // Keyboard Text
    commands
        .spawn((
            TextData {
                height: IMAGE_GROUP_BOX_INIT_HEIGHT,
                width: IMAGE_GROUP_BOX_INIT_WIDTH,
            },