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

Feature Request: Top-level comment for license notice in .rs files #6179

Closed
psandana opened this issue May 31, 2024 · 1 comment
Closed

Feature Request: Top-level comment for license notice in .rs files #6179

psandana opened this issue May 31, 2024 · 1 comment

Comments

@psandana
Copy link

 I want to request/propose an optional feature that will be handy for some projects. Often, projects would like to state their license in the top-level part of every source file. This includes private and public licenses.

It would be handy a formatting option that, if enabled and configured,:

  • Checks the presence of a given text as a top-level comment (with // <my comment).
  • Introduces the given text as a top-level comment if missing.

Example:

use something;

fn main() {
something::do_sth();
}

to

// Licensed under the MIT License.
use something;

fn main() {
something::do_sth();
}

This could be a single-line, or multi-line comment, acknowledging that some projects may have 2 or more licenses.

@ytmimi
Copy link
Contributor

ytmimi commented May 31, 2024

There was a time when rustfmt did something like this, but we dropped support for it because we felt that rustfmt wasn't the right tool. You can read more at #5103

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
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

No branches or pull requests

2 participants