Skip to content

Conversation

@anforowicz
Copy link

PTAL?

This PR is an attempt to upstream some Chromium-specific guidelines from https://source.chromium.org/chromium/chromium/src/+/main:docs/rust/api_design.md;l=56-66;drc=e213d50dfa608aba386b151f831d6e25f849bcac.

I hope that covering not only parameter types, but also return types is mostly uncontroversial.

I think that discouraging the use of tuples in public APIs matches the spirit of the rule. I understand that sometimes the meaning of tuples is obvious from the context - e.g. it seems totally fine to return a tuple from unzip. But I think that the situation here is similar to a bool return type - it may be sometimes okay to return a bool (e.g. from is_empty or from is_small or is_round), but one should still consider using a more specific parameter and/or return type if possible.

The fact that bool is okay in many is_foo functions makes me wonder if this PR should instead be adding a new rule to the guidelines. But I think that editing the C-CUSTOM-TYPE rule is still reasonable and keeps things simple. WDYT?

/cc @DKLoehr, @zetafunction, @Manishearth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant