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

[433] remove old run function #441

Closed
wants to merge 5 commits into from

Conversation

sepiropht
Copy link

@sepiropht sepiropht commented Aug 12, 2018

fixes #433

Things to check before submitting a PR

  • the tests are passing locally with cargo test
  • cookbook renders correctly in mdbook serve -o
  • commits are squashed into one and rebased to latest master
  • PR contains correct "fixes #ISSUE_ID" clause to autoclose the issue on PR merge
    • if issue does not exist consider creating it or remove the clause
  • spell check runs without errors ./ci/spellchecker.sh
  • link check runs without errors link-checker ./book
  • non rendered items are in sorted order (links, reference, identifiers, Cargo.toml)
  • links to docs.rs have wildcard version https://docs.rs/tar/*/tar/struct.Entry.html
  • example has standard error handling
  • code identifiers in description are in hyperlinked backticks
[`Entry::unpack`]: https://docs.rs/tar/*/tar/struct.Entry.html#method.unpack

Things to do after submitting PR

  • check if CI is happy with your PR

Thank you for reading, you may now delete this text! Thank you! 😄

@sepiropht sepiropht force-pushed the master branch 3 times, most recently from 80e4992 to c62eba1 Compare August 14, 2018 09:53
Copy link
Collaborator

@AndyGauge AndyGauge left a comment

Choose a reason for hiding this comment

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

I really appreciate this work, but would like to see some additional cleanup as noted in the requests.

src/about.md Outdated
@@ -107,7 +107,7 @@ Since these recipes are intended to be reused as-is and encourage best
practices, they set up error handling correctly when there are
`Result` types involved.

The basic pattern we use is to have a `fn run() -> Result` that acts
The basic pattern we use is to have a `fn main() -> Result` that acts
Copy link
Collaborator

Choose a reason for hiding this comment

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

two lines after this, run is referenced again.

src/about.md Outdated
@@ -167,14 +166,14 @@ use url::{Url, Position};
# }
# }

fn run() -> Result<()> {
fn main() -> Result<()> {
let parsed = Url::parse("https://httpbin.org/cookies/set?k2=v2&k1=v1")?;
let cleaned: &str = &parsed[..Position::AfterPath];
println!("cleaned: {}", cleaned);
Ok(())
}
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

These trailing # should be removed too.

@sepiropht sepiropht force-pushed the master branch 2 times, most recently from 89a4f96 to e8d288d Compare August 18, 2018 07:18
@sepiropht
Copy link
Author

I thought that i have finished but now i have problem with the two build future (see issue #29642) --> C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\log4rs-0.8.0\src\append\rolling_file\mod.rs:46:1 | 46 | #[serde(deny_unknown_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable
This repo is not on discord ?

@AndyGauge
Copy link
Collaborator

I just tested Master against this, this is a bug introduced by Rust 1.30

I will create a new issue

@sepiropht
Copy link
Author

Ok thank @AndyGauge !

@sepiropht
Copy link
Author

We will wait until the bug fix before merge this pr ?

Copy link
Collaborator

@budziq budziq left a comment

Choose a reason for hiding this comment

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

Thanks @sepiropht
Nice work some minor suggestions follow.
Please double check for any whitespace problems, trailing newlines or unneeded #

@@ -66,7 +64,7 @@ fn run() -> Result<()> {
Ok(())
}
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove the trailing # and all uses of error_chain when not completely necessary.

@@ -30,7 +30,7 @@ header! { (XRateLimitLimit, "X-RateLimit-Limit") => [usize] }
header! { (XRateLimitRemaining, "X-RateLimit-Remaining") => [usize] }
header! { (XRateLimitReset, "X-RateLimit-Reset") => [u64] }

fn run() -> Result<()> {
fn main() -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This example requires slightly larger rewrite. It was never ideal with recursive run but rename to main has made it even more apparent. Some minimal main should be extracted that calls possibly still recursive run (I'd most likely appreciate rewriting it to iterative form).

@@ -85,7 +83,7 @@ fn run() -> Result<()> {
Ok(())
}
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove this and other occurrences of the trailing #

@@ -85,7 +83,7 @@ fn run() -> Result<()> {
Ok(())
}
#
# quick_main!(run);

Copy link
Collaborator

Choose a reason for hiding this comment

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

no reason for trailing newline

@@ -92,5 +91,5 @@ fn run() -> Result<()> {
Ok(())
}
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove this and other occurrences of the trailing #

@@ -37,8 +37,7 @@ fn run() -> Result<()> {

Ok(())
}
#
# quick_main!(run);

Copy link
Collaborator

Choose a reason for hiding this comment

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

no reason for trailing newline

@@ -39,11 +39,10 @@ fn run() -> Result<()> {
# #[cfg(not(target_os = "linux"))]
# error_chain! {}
# #[cfg(not(target_os = "linux"))]
# fn run() -> Result<()> {
# fn main() -> Result<()> {
# Ok(())
# }
#
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove the trailing #

src/about.md Outdated
work. The `quick_main!` macro generates the actual `main` function and
prints out the error if one occurred.
work. Since rust 1.26, the main function can return a value, no need
to use a custom `run` function like before.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence
Since rust 1.26, the main function can return a value, no need to use a custom run function like before. should not be necessary

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the reviews, i will do this asap

@AndyGauge
Copy link
Collaborator

I believe nightly rust works again, so I've triggered a build. I approved the commit that happened after my comments, and before Budziq. At this point, there are some more requested changes. Please let me know if you are following the requests, or if you would like fresh eyes on it. Great work so far!

@sepiropht
Copy link
Author

Ok cool ! I will do all the changes very soon.

@sepiropht
Copy link
Author

Apart conflicts this branch should be ok no ?

@AndyGauge
Copy link
Collaborator

I would love to see this land, I'll be working on your branch a little--hope you don't mind.

@workingjubilee workingjubilee mentioned this pull request Sep 19, 2019
11 tasks
@AndyGauge AndyGauge closed this Sep 19, 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.

Replace quick_main with main returning Result
3 participants