Skip to content

Allow dead code to avoid warning #1688

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

Merged
merged 1 commit into from
Mar 31, 2023
Merged

Allow dead code to avoid warning #1688

merged 1 commit into from
Mar 31, 2023

Conversation

Bi0T1N
Copy link
Contributor

@Bi0T1N Bi0T1N commented Mar 11, 2023

Without it the compiler generates following warning:

warning: variant `Fahrenheit` is never constructed

@rustbot
Copy link
Collaborator

rustbot commented Mar 11, 2023

Failed to set assignee to marioidival: cannot assign: HTTP status client error (403 Forbidden) for url (https://api.github.com/repos/rust-lang/rust-by-example/issues/1688/assignees)

Note: Only org members, users with write permissions, or people who have commented on the PR may be assigned.

@rustbot
Copy link
Collaborator

rustbot commented Mar 11, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @marioidival (or someone else) soon.

Copy link
Member

@marioidival marioidival left a comment

Choose a reason for hiding this comment

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

Nice, but can I suggest something? Can you add some example to fill the gap instead of remove the warning?

@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Mar 21, 2023

As far as I understood the user should change the line let temperature = Temperature::Celsius(35); and test different numbers as well as using let temperature = Temperature::Fahrenheit(35);. For the latter one the compiler will bark at Temperature::Celsius because it is dead code then.

@marioidival marioidival merged commit 4a9228f into rust-lang:master Mar 31, 2023
@Bi0T1N Bi0T1N deleted the guards_deadcode branch March 31, 2023 19:08
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 3, 2023
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.

3 participants