Skip to content

where clauses have no indentation #541

Closed

Description

@msfjarvis

As a result of some deprecation strife, Android Gradle Plugin has forced me to write code that looks like this:

private fun <T> disableTestsForVariant(variant: T) where
T : HasUnitTestBuilder,
T : HasAndroidTestBuilder {
  variant.enableAndroidTest = false
  variant.enableUnitTest = false
}

This is the formatted result from ktfmt, and I think it could use some reorganization although I have no strong opinions on how it should look. As a data point, this is how it looks like in Rust (I don't think the exact style belongs in Kotlin, but it's a good place to start):

fn print_embedded_urls<F>(iterator: Iter<'_, Tweet>, filter: F)
where
    F: FnMut(&Url) -> bool,
{
    iterator
        .map(|status| &status.entities)
        .flat_map(|entities| &entities.urls)
        .filter_map(|url| url.expanded_url.as_ref())
        .flat_map(|url| Url::parse(url))
        .filter(filter)
        .for_each(|url| println!("{url}"));
}

Activity

  1. added
    enhancement
    on May 19, 2025
  2. added a commit that references this issue on Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo