Skip to content

weird spacing and alignment with &&, !, and unsafe block #3770

Closed
@lopopolo

Description

@lopopolo

rustfmt formats this code funnily. This is the formatted output:

            unsafe { sys::mrb_sys_value_is_false(value) }
            &&!unsafe { sys::mrb_sys_value_is_true(value) }
                && !unsafe { sys::mrb_sys_value_is_nil(value) }

An alternate branch in the conditional formats correctly:

            !unsafe { sys::mrb_sys_value_is_false(value) }
                && unsafe { sys::mrb_sys_value_is_true(value) }
                && !unsafe { sys::mrb_sys_value_is_nil(value) }

Attaching the && to the expression causes rustc to take a double reference and the code does not compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions