Skip to content

Add multiple author support to module!#904

Open
wcampbell0x2a wants to merge 1 commit intoRust-for-Linux:rustfrom
wcampbell0x2a:add-authors-module
Open

Add multiple author support to module!#904
wcampbell0x2a wants to merge 1 commit intoRust-for-Linux:rustfrom
wcampbell0x2a:add-authors-module

Conversation

@wcampbell0x2a
Copy link
Copy Markdown

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

See #244

Comment thread samples/rust/rust_minimal.rs Outdated
@wcampbell0x2a
Copy link
Copy Markdown
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
Comment thread rust/macros/module.rs Outdated
if let Some(s) = try_string(&mut stream) {
authors.push(s);
}
if try_punct(&mut stream).is_none() {
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread rust/macros/module.rs Outdated
authors.push(s);
}
if try_punct(&mut stream).is_none() {
assert_eq!(group.delimiter(), Delimiter::Bracket);
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread rust/macros/module.rs Outdated
assert_eq!(group.delimiter(), Delimiter::Bracket);
let mut stream = group.stream().into_iter();
loop {
if let Some(s) = try_string(&mut stream) {
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Member

nbdd0121 commented Oct 7, 2022

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

@wcampbell0x2a
Copy link
Copy Markdown
Author

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

@ojeda do you have comments on this?

Comment thread rust/macros/module.rs
@ojeda
Copy link
Copy Markdown
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
Copy Markdown
Author

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

@adamrk
Copy link
Copy Markdown

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
Copy Markdown

adamrk commented Mar 27, 2023

Also the changes now look good to me.

@wcampbell0x2a
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread rust/macros/module.rs
info
}

/// Parse ["First", "Second"] into Some(vec!["First", "Second"])
Copy link
Copy Markdown
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