Skip to content

util/generate: Use the same template for all generations#885

Merged
coriolinus merged 2 commits intoexercism:masterfrom
dvermd:util_template
Oct 11, 2019
Merged

util/generate: Use the same template for all generations#885
coriolinus merged 2 commits intoexercism:masterfrom
dvermd:util_template

Conversation

@dvermd
Copy link
Copy Markdown
Contributor

@dvermd dvermd commented Oct 7, 2019

This PR also do not repeat the test name creation.

Resolves: #679

Copy link
Copy Markdown
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @dvermd!

I know that the extern crate change is distinct from the primary intent of this PR. Therefore I do not think we should block this PR on that change. However, I would look favorably on adding a commit which removed the generated extern crate lines.

I will now give this PR a few days to ensure that other maintainers have had time to review and comment. If there is no objection, I intend to merge this on Friday.

Comment thread util/exercise/src/cmd/generate.rs Outdated

test_file.write_all(
&format!(
"extern crate {escaped_exercise_name};\n\
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As this track now uses the 2018 edition by default, we can remove the extern crate line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll remove that.
Following this advice, what about also changing

#[macro_use]
extern crate maplit;

to
use maplit::*;

@coriolinus
Copy link
Copy Markdown
Member

coriolinus commented Oct 8, 2019 via email

@dvermd
Copy link
Copy Markdown
Contributor Author

dvermd commented Oct 8, 2019

A quick example from maplit shows that use maplit::maplit; is not working and one should write use maplit::hashmap; if the hashmap! macro is to be used.

Right now, there's 5 macros in the maplit crate. I might import them all explicitly and then cargo build will warn about unused imports.
I'm not happy with this but this is the best I can think right now.

Another point : should I remove one of the "[utility][utility]" in the template ? I didn't manage to find documentation on a specific behaviour related to "[]" in doc comments.

@coriolinus
Copy link
Copy Markdown
Member

coriolinus commented Oct 8, 2019 via email

@coriolinus coriolinus merged commit d40d5c4 into exercism:master Oct 11, 2019
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.

exercise util should use the same template

3 participants