Skip to content

Commit

Permalink
compiler: fix unused_peekable clippy lint
Browse files Browse the repository at this point in the history
warning: `peek` never called on `Peekable` iterator
   --> compiler\rustc_session\src\utils.rs:130:13
    |
130 |     let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()).peekable();
    |             ^^^^
    |
    = help: consider removing the call to `peekable`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable

warning: `peek` never called on `Peekable` iterator
    --> compiler\rustc_trait_selection\src\traits\error_reporting\suggestions.rs:4934:17
     |
4934 |         let mut bounds = pred.bounds.iter().peekable();
     |                 ^^^^^^
     |
     = help: consider removing the call to `peekable`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable
  • Loading branch information
klensy committed Mar 28, 2024
1 parent 463a11b commit bf47641
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {

const ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE: &[&str] = &["incremental"];

let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()).peekable();
let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string());

let mut result = Vec::new();
let mut excluded_cargo_defaults = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4931,7 +4931,7 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
let hir::WherePredicate::BoundPredicate(pred) = pred else {
continue;
};
let mut bounds = pred.bounds.iter().peekable();
let mut bounds = pred.bounds.iter();
while let Some(bound) = bounds.next() {
let Some(trait_ref) = bound.trait_ref() else {
continue;
Expand Down

0 comments on commit bf47641

Please sign in to comment.