-
Notifications
You must be signed in to change notification settings - Fork 13.4k
tutorial : Correct pattern matching _
instead of ..
#11969
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@eliovir Can you squash these commits? Also you still have an LLVM submodule change. |
As @Armavica points out, |
benchmarking. This allows a result to be marked as "used" by passing it to a function LLVM cannot see inside. By making `iter` generic and using this `black_box` on the result benchmarks can get this behaviour simply by returning their computation.
Before: test test::bench_nonpod_nonarena ... bench: 62 ns/iter (+/- 6) test test::bench_pod_nonarena ... bench: 0 ns/iter (+/- 0) After: test test::bench_nonpod_nonarena ... bench: 158 ns/iter (+/- 11) test test::bench_pod_nonarena ... bench: 48 ns/iter (+/- 2) The other tests show no change, but are adjusted to use the generic return value of `.iter` anyway so that this doesn't change in future.
This allows a result to be marked as "used" by passing it to a function LLVM cannot see inside (unless LTO is enabled). Closes #8261.
These are ancient. I removed a bunch of questions that are less relevant - or completely unrelevant, updated other entries, and removed things that are already better expressed elsewhere.
I don't know if anything depends on MemReader::fill returning an empty slice instead of EndOfFile, but I'm pretty sure that MemReader::read_until should not go into an infinite loop.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 24, 2024
… r=y21 Unused trait imports (formerly anonymous trait import) For rust-lang#11969 I'm looking for help and feedback on implementing a new lint for suggesting `use ... as _` for traits where possible. I have had a go at implementing this but I don't know if this is the best way to do it as I am new to clippy. There are some edge cases I can think of where this doesn't work but have aired on the side of false negatives instead of false positives. An example of a false negative. I couldn't figure out the best way to resolve an import from within clippy. The sub module imports MyAny so that cannot be anonymized but `use std::any::Any` could be. In this case it is not caught because `Any` and `MyAny` have the same DefId. ```rust mod nested_mod_used_bad1 { use std::any::Any; use std::any::Any as MyAny; mod foo { use crate::nested_mod_used_bad1::MyAny; fn foo() { println!("{:?}", MyAny::type_id("foo")); } } } ``` Any feedback is much appreciated. ------- changelog: new lint: `unused_trait_names`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checking code examples from tutorial against Rust (0.10-pre 30e9bba 2014-01-30 07:06:27).
NB : This pull request contains wrong change about src/llvm. Submodules were updated and I can't set src/llvm to its revision.