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

Do not enforce two newlines after the options #8131

Closed
wants to merge 1 commit into from

Conversation

Seldaek
Copy link
Contributor

@Seldaek Seldaek commented Jul 30, 2013

It makes things ugly when the last thing you print is the usage() output, resulting in something like:

$ rust run foo.rs -h
Lala

Options:
    -h --help           display this help and exit
    -V --version        output version information and exit

$ prompt

@brson
Copy link
Contributor

brson commented Jul 30, 2013

I guess beauty is in the eye of the beholder since presumably we added those newlines specifically to separate the usage output from the succeeding prompt. To be clear this change will result in output like the following?

$ rust run foo.rs -h
Lala

Options:
    -h --help           display this help and exit
    -V --version        output version information and exit
$ prompt

What is the precedent here and are there any accepted standards?

@brson
Copy link
Contributor

brson commented Jul 30, 2013

Either way, it seems like this should be encoded in the getopts usage string and not open-coded at every call site.

@brson
Copy link
Contributor

brson commented Jul 30, 2013

Ok, I tried a few different binary's --help option and none included the extra newline...

bors added a commit that referenced this pull request Jul 30, 2013
It makes things ugly when the last thing you print is the usage() output, resulting in something like:

```
$ rust run foo.rs -h
Lala

Options:
    -h --help           display this help and exit
    -V --version        output version information and exit

$ prompt
```
@bors bors closed this Jul 30, 2013
@Seldaek
Copy link
Contributor Author

Seldaek commented Jul 31, 2013

Thanks @brson, indeed it's not a common practice as far as I can see, and I prefer to leave the choice to the caller (of course one could strip the last \n but that's less obvious than adding one).

flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 21, 2022
In all the cases I've observed, it did not make the code clearer. Using
bools as integer is frowned upon in some languages, in others it's
simply not possible.

You can find comments on the original pull request rust-lang#8131 that agree with
this point of view.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 21, 2022
…arth

Make `bool_to_int_with_if` a pedantic lint

In all the cases I've observed, it did not make the code clearer. Using bools as integer is frowned upon in some languages, in others it's simply not possible.

You can find comments on the original pull request rust-lang#8131 that agree with this point of view.

changelog: [`bool_to_int_with_if`]: Change the categorization to pedantic
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.

3 participants