Skip to content

Recommended style for long method generics. #208

Open
@konnorandrews

Description

@konnorandrews

In relation to rust-lang/rustfmt#6507,

pub fn cli() -> Command {
    subcommand("uninstall")
        .about("Remove a Rust binary")
-       .arg(
-           Arg::new("spec")
-               .value_name("SPEC")
-               .num_args(0..)
-               .add::<clap_complete::ArgValueCandidates>(clap_complete::ArgValueCandidates::new(
-                   || get_installed_crates(),
-               )),
-       )
+       .arg(Arg::new("spec").value_name("SPEC").num_args(0..).add::<
+           clap_complete::ArgValueCandidates,
+       >(
+           clap_complete::ArgValueCandidates::new(|| get_installed_crates()),
+       ))
        .arg(opt("root", "Directory to uninstall packages from").value_name("DIR"))
        .arg_silent_suggestion()
        .arg_package_spec_simple("Package to uninstall")
        .arg(
            multi_opt("bin", "NAME", "Only uninstall the binary NAME")
                .help_heading(heading::TARGET_SELECTION),
        )
        .after_help(color_print::cstr!(
            "Run `<cyan,bold>cargo help uninstall</>` for more detailed information.\n"
        ))
}

Which of these should be preferred? Rustfmt currently ends up with red because it never wraps method generics. If we allow method generics to wrap then we get cases like green. Should wrapping a chain be preferred over wrapping any of the method generics in the chain?

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