Skip to content

Add multiple author support to module! #904

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

Open
wants to merge 1 commit into
base: rust
Choose a base branch
from

Conversation

wcampbell0x2a
Copy link

Change author into authors, allowing multiple authors of a module.

See #244

@wcampbell0x2a
Copy link
Author

This might also work for #246

@wcampbell0x2a wcampbell0x2a force-pushed the add-authors-module branch 4 times, most recently from c714569 to 3cd4350 Compare October 2, 2022 14:25
if let Some(s) = try_string(&mut stream) {
authors.push(s);
}
if try_punct(&mut stream).is_none() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this would accept any punctuation between the authors. We probably just want ,, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, see new commit.

authors.push(s);
}
if try_punct(&mut stream).is_none() {
assert_eq!(group.delimiter(), Delimiter::Bracket);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we already check this above?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, see new commit.

assert_eq!(group.delimiter(), Delimiter::Bracket);
let mut stream = group.stream().into_iter();
loop {
if let Some(s) = try_string(&mut stream) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably expect_string here. Otherwise we'd allow extra commas without any authors in between.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, see new commit.

@nbdd0121
Copy link
Member

nbdd0121 commented Oct 7, 2022

I suppose we could accept both an array or a single string literal?

@wcampbell0x2a
Copy link
Author

I suppose we could accept both an array or a single string literal?

@ojeda do you have comments on this?

@ojeda
Copy link
Member

ojeda commented Oct 19, 2022

@ojeda do you have comments on this?

It sounds like a good idea, but then again it introduces complexity that is not really needed, so I am ambivalent. Having always the list, even with 1 entry, is simpler to learn and to implement, and makes it obvious there may be several authors for those that may not know about it. Cargo.toml does the same with the authors key.

@wcampbell0x2a wcampbell0x2a force-pushed the add-authors-module branch 3 times, most recently from 0e6bdaf to 29a545e Compare January 7, 2023 04:52
Change author into authors, allowing multiple authors of a module.

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
@wcampbell0x2a
Copy link
Author

Updated, let me know if this looks good or needs any other modifications.

@adamrk
Copy link

adamrk commented Mar 27, 2023

Sorry, I missed the recent updates - @ojeda is the process now that these should be submitted to the mailing list?

@adamrk
Copy link

adamrk commented Mar 27, 2023

Also the changes now look good to me.

@wcampbell0x2a
Copy link
Author

Sorry, I missed the recent updates - @ojeda is the process now that these should be submitted to the mailing list?

Either way, I can re-submit the patch.

@ojeda
Copy link
Member

ojeda commented Mar 28, 2023

@ojeda is the process now that these should be submitted to the mailing list?

Yeah, that is right, we are in the process of submitting things piece by piece to upstream. Please see https://rust-for-linux.com/contributing and https://rust-for-linux.com/branches for some details.

Copy link
Member

@ojeda ojeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, this should update the example at rust/macros/lib.rs too.

@@ -300,6 +300,26 @@ impl ModuleInfo {

info
}

/// Parse ["First", "Second"] into Some(vec!["First", "Second"])
Copy link
Member

@ojeda ojeda Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Parse ["First", "Second"] into Some(vec!["First", "Second"])
/// Parses `["First", "Second"]` into `Some(vec!["First", "Second"])`.

i.e. please use Markdown, a period at the end, and the third person.

In addition, this does not add Some(...) -- it is the caller that does it, no?

I would reword it like this instead, if you want to give an example:

Suggested change
/// Parse ["First", "Second"] into Some(vec!["First", "Second"])
/// Parses a list of authors.
///
/// # Examples
///
/// Parsing `["First", "Second"]` returns a `vec!["First", "Second"]`.

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

Successfully merging this pull request may close these issues.

5 participants