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

assignment is not formatted properly #6394

Closed
BenjaminBrienen opened this issue Nov 17, 2024 · 1 comment
Closed

assignment is not formatted properly #6394

BenjaminBrienen opened this issue Nov 17, 2024 · 1 comment

Comments

@BenjaminBrienen
Copy link

"formatted" code:

    pub(crate) fn register_info<T: Bundle>(
        &mut self,
        components: &mut Components,
        storages: &mut Storages,
    ) -> BundleId {
        let bundle_infos = &mut self.bundle_infos;
        let id = *self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
            let mut component_ids= Vec::new();
            T::component_ids(components, storages, &mut |id| component_ids.push(id));
            let id = BundleId(bundle_infos.len());
            let bundle_info =
                // SAFETY: T::component_id ensures:
                // - its info was created
                // - appropriate storage for it has been initialized.
                // - it was created in the same order as the components in T
                unsafe { BundleInfo::new(core::any::type_name::<T>(), components, component_ids, id) };
            bundle_infos.push(bundle_info);
            id
        });
        id
    }

The focus:

let mut component_ids= Vec::new();

Expected:

let mut component_ids = Vec::new();
@ytmimi
Copy link
Contributor

ytmimi commented Nov 18, 2024

This line unsafe { BundleInfo::new(core::any::type_name::<T>(), components, component_ids, id) }; is 103 characters long, which exceeds the default max_width of 100. Because this is inside the .or_insert_with() call this is a duplicate of #3863. You can bump the max_width and rustfmt will be able to format this chained method call.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants