-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87614 - notriddle:notriddle-count2len, r=Mark-Simula…
…crum Recommend fix `count()` -> `len()` on slices Fixes #87302
- Loading branch information
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -499,6 +499,7 @@ symbols! { | |
core_panic_macro, | ||
cosf32, | ||
cosf64, | ||
count, | ||
cr, | ||
crate_id, | ||
crate_in_paths, | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
let slice = [1,2,3,4]; | ||
let vec = vec![1,2,3,4]; | ||
|
||
slice.count(); //~ERROR: E0599 | ||
vec.count(); //~ERROR: E0599 | ||
vec.as_slice().count(); //~ERROR: E0599 | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error[E0599]: no method named `count` found for array `[{integer}; 4]` in the current scope | ||
--> $DIR/count2len.rs:5:11 | ||
| | ||
LL | slice.count(); | ||
| ^^^^^ | ||
| | | ||
| method cannot be called on `[{integer}; 4]` due to unsatisfied trait bounds | ||
| help: consider using `len` instead | ||
| | ||
= note: `count` is defined on `Iterator`, which `[{integer}; 4]` does not implement | ||
|
||
error[E0599]: no method named `count` found for struct `Vec<{integer}>` in the current scope | ||
--> $DIR/count2len.rs:6:9 | ||
| | ||
LL | vec.count(); | ||
| ^^^^^ | ||
| | | ||
| method cannot be called on `Vec<{integer}>` due to unsatisfied trait bounds | ||
| help: consider using `len` instead | ||
| | ||
= note: `count` is defined on `Iterator`, which `Vec<{integer}>` does not implement | ||
|
||
error[E0599]: no method named `count` found for reference `&[{integer}]` in the current scope | ||
--> $DIR/count2len.rs:7:20 | ||
| | ||
LL | vec.as_slice().count(); | ||
| ^^^^^ | ||
| | | ||
| method cannot be called on `&[{integer}]` due to unsatisfied trait bounds | ||
| help: consider using `len` instead | ||
| | ||
= note: `count` is defined on `Iterator`, which `&[{integer}]` does not implement | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0599`. |