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

Upgrade to Rust 2021 Edition #340

Merged
merged 4 commits into from
Nov 4, 2021
Merged

Conversation

jamcleod
Copy link
Contributor

Closes #337, cc @andreafioraldi for review.

@jamcleod
Copy link
Contributor Author

The CI failure appears to be because your github workflow relies on the default installed cargo. As of time of writing this comment, the ubuntu image github actions uses is on Rust 1.55.0 (one version older than current), but that'll likely change soon as versions get bumped pretty often. If you need a more short-term solution, using the Rust toolchain action will allow you to control this (use a newer one than github provides, pin a minimum Rust version, etc.)

@jamcleod
Copy link
Contributor Author

And honestly I couldn't tell you why only one of the jobs seems to have this issue, they really all should be failing with the same error.

@domenukk
Copy link
Member

Sounds like we should wait a bit before merging, waiting for tools to settle, then?

@jamcleod
Copy link
Contributor Author

Sounds like we should wait a bit before merging, waiting for tools to settle, then?

Sounds good to me. Looks like actions/runner-images#4324 is tracking this, and should be fixed in a bit over a week when the environment gets updated. I'll rebase the PR at that point if there's any merge conflicts and then let you know to rerun CI.

Comment on lines 125 to 129
let port: u16 = std::env::args()
.nth(2)
.unwrap_or("1337".into())
.unwrap_or_else(|| "1337".into())
.parse::<u16>()
.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider doing it this way, avoiding a string allocation and runtime parsing the default case:

    let port: u16 = std::env::args()
        .nth(2)
        .map(|port| port.parse().unwrap()) // if an arg is provided, parse as u16 and panic on fail
        .unwrap_or(1337);                  // since the value is constant, no need for runtime calculation using a closure

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I know that's not the point of this PR, but since I was looking anyway)

Copy link
Member

Choose a reason for hiding this comment

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

nah that's not really important, it's code in a test executed just one time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was actually what I was originally going to do but I didn't want to descend too heavily into actual code cleanup/changes, and mostly just wanted to make sure things weren't in a worse state clippy-wise than before

@andreafioraldi
Copy link
Member

Ty! We will wait for #341 and then merge this one after solving the CI issues.

@andreafioraldi andreafioraldi merged commit 3d436b7 into AFLplusplus:main Nov 4, 2021
khang06 pushed a commit to khang06/LibAFL that referenced this pull request Oct 11, 2022
* Enable missing const_xxh3 feature

* Move to Rust 2021 Edition

* Fix clippy complaints

* Remove imports made unecessary in 2021 edition
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.

Port to Rust 2021
4 participants