Fix unused_variables in tests

This commit is contained in:
hkalbasi 2023-09-24 23:45:36 +03:30
parent 7834b8fadb
commit ab52ba2de7
13 changed files with 122 additions and 104 deletions

View File

@ -1774,13 +1774,14 @@ fn lower_block_to_place(
}
}
}
hir_def::hir::Statement::Expr { expr, has_semi: _ } => {
&hir_def::hir::Statement::Expr { expr, has_semi: _ } => {
let scope2 = self.push_drop_scope();
let Some((_, c)) = self.lower_expr_as_place(current, *expr, true)? else {
let Some((p, c)) = self.lower_expr_as_place(current, expr, true)? else {
scope2.pop_assume_dropped(self);
scope.pop_assume_dropped(self);
return Ok(None);
};
self.push_fake_read(c, p, expr.into());
current = scope2.pop_and_drop(self, c);
}
}

View File

@ -166,7 +166,7 @@ fn test_check_pat_field_shorthand() {
check_diagnostics(
r#"
struct A { a: &'static str }
fn f(a: A) { let A { a: hello } = a; }
fn f(a: A) { let A { a: _hello } = a; }
"#,
);
check_diagnostics(
@ -181,12 +181,14 @@ struct A { a: &'static str }
struct A { a: &'static str }
fn f(a: A) {
let A { a$0: a } = a;
_ = a;
}
"#,
r#"
struct A { a: &'static str }
fn f(a: A) {
let A { a } = a;
_ = a;
}
"#,
);
@ -196,12 +198,14 @@ fn f(a: A) {
struct A { a: &'static str, b: &'static str }
fn f(a: A) {
let A { a$0: a, b } = a;
_ = (a, b);
}
"#,
r#"
struct A { a: &'static str, b: &'static str }
fn f(a: A) {
let A { a, b } = a;
_ = (a, b);
}
"#,
);

View File

@ -175,10 +175,10 @@ fn NonSnakeCaseName() {}
fn incorrect_function_params() {
check_diagnostics(
r#"
fn foo(SomeParam: u8) {}
fn foo(SomeParam: u8) { _ = SomeParam; }
// ^^^^^^^^^ 💡 warn: Parameter `SomeParam` should have snake_case name, e.g. `some_param`
fn foo2(ok_param: &str, CAPS_PARAM: u8) {}
fn foo2(ok_param: &str, CAPS_PARAM: u8) { _ = (ok_param, CAPS_PARAM); }
// ^^^^^^^^^^ 💡 warn: Parameter `CAPS_PARAM` should have snake_case name, e.g. `caps_param`
"#,
);
@ -188,6 +188,7 @@ fn foo2(ok_param: &str, CAPS_PARAM: u8) {}
fn incorrect_variable_names() {
check_diagnostics(
r#"
#[allow(unused)]
fn foo() {
let SOME_VALUE = 10;
// ^^^^^^^^^^ 💡 warn: Variable `SOME_VALUE` should have snake_case name, e.g. `some_value`
@ -294,6 +295,7 @@ fn SomeFunc(&self) {
// ^^^^^^^^ 💡 warn: Function `SomeFunc` should have snake_case name, e.g. `some_func`
let WHY_VAR_IS_CAPS = 10;
// ^^^^^^^^^^^^^^^ 💡 warn: Variable `WHY_VAR_IS_CAPS` should have snake_case name, e.g. `why_var_is_caps`
_ = WHY_VAR_IS_CAPS;
}
}
"#,
@ -306,6 +308,7 @@ fn no_diagnostic_for_enum_variants() {
r#"
enum Option { Some, None }
#[allow(unused)]
fn main() {
match Option::None {
None => (),
@ -322,6 +325,7 @@ fn non_let_bind() {
r#"
enum Option { Some, None }
#[allow(unused)]
fn main() {
match Option::None {
SOME_VAR @ None => (),
@ -349,7 +353,9 @@ enum E {
}
mod F {
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {
_ = BAD_NAME_HI;
}
}
"#,
);
@ -395,7 +401,7 @@ mod foo {
#[test] // Issue #8809.
fn parenthesized_parameter() {
check_diagnostics(r#"fn f((O): _) {}"#)
check_diagnostics(r#"fn f((O): _) { _ = O; }"#)
}
#[test]
@ -472,7 +478,9 @@ mod CheckBadStyle {
mod F {
#![allow(non_snake_case)]
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {}
fn CheckItWorksWithModAttr(BAD_NAME_HI: u8) {
_ = BAD_NAME_HI;
}
}
#[allow(non_snake_case, non_camel_case_types)]

View File

@ -131,7 +131,7 @@ fn zero() {}
fn simple_free_fn_one() {
check_diagnostics(
r#"
fn one(arg: u8) {}
fn one(_arg: u8) {}
fn f() { one(); }
//^^ error: expected 1 argument, found 0
"#,
@ -139,7 +139,7 @@ fn one(arg: u8) {}
check_diagnostics(
r#"
fn one(arg: u8) {}
fn one(_arg: u8) {}
fn f() { one(1); }
"#,
);
@ -176,7 +176,7 @@ fn method_with_arg() {
check_diagnostics(
r#"
struct S;
impl S { fn method(&self, arg: u8) {} }
impl S { fn method(&self, _arg: u8) {} }
fn f() {
S.method();
@ -187,7 +187,7 @@ fn f() {
check_diagnostics(
r#"
struct S;
impl S { fn method(&self, arg: u8) {} }
impl S { fn method(&self, _arg: u8) {} }
fn f() {
S::method(&S, 0);
@ -335,8 +335,8 @@ fn foo(#[cfg(NEVER)] x: ()) {}
impl S {
fn method(#[cfg(NEVER)] self) {}
fn method2(#[cfg(NEVER)] self, arg: u8) {}
fn method3(self, #[cfg(NEVER)] arg: u8) {}
fn method2(#[cfg(NEVER)] self, _arg: u8) {}
fn method3(self, #[cfg(NEVER)] _arg: u8) {}
}
extern "C" {
@ -365,8 +365,8 @@ fn legacy_const_generics() {
r#"
#[rustc_legacy_const_generics(1, 3)]
fn mixed<const N1: &'static str, const N2: bool>(
a: u8,
b: i8,
_a: u8,
_b: i8,
) {}
fn f() {
@ -376,8 +376,8 @@ fn f() {
#[rustc_legacy_const_generics(1, 3)]
fn b<const N1: u8, const N2: u8>(
a: u8,
b: u8,
_a: u8,
_b: u8,
) {}
fn g() {
@ -403,7 +403,7 @@ fn f(
// ^^ error: this pattern has 0 fields, but the corresponding tuple struct has 2 fields
S(e, f, .., g, d): S
// ^^^^^^^^^ error: this pattern has 4 fields, but the corresponding tuple struct has 2 fields
) {}
) { _ = (a, b, c, d, e, f, g); }
"#,
)
}

View File

@ -290,6 +290,7 @@ fn missing_record_pat_field_ref() {
struct S { s: u32 }
fn x(a: S) {
let S { ref s } = a;
_ = s;
}
",
)
@ -626,7 +627,7 @@ struct TestStruct { one: i32, two: i64 }
fn test_fn() {
let one = 1;
let s = TestStruct{ one, two: 2 };
let _s = TestStruct{ one, two: 2 };
}
"#,
);

View File

@ -19,6 +19,7 @@ pub(crate) fn missing_match_arms(
mod tests {
use crate::tests::check_diagnostics;
#[track_caller]
fn check_diagnostics_no_bails(ra_fixture: &str) {
cov_mark::check_count!(validate_match_bailed_out, 0);
crate::tests::check_diagnostics(ra_fixture)
@ -564,6 +565,7 @@ fn unknown_type() {
r#"
enum Option<T> { Some(T), None }
#[allow(unused)]
fn main() {
// `Never` is deliberately not defined so that it's an uninferred type.
match Option::<Never>::None {
@ -719,7 +721,7 @@ fn no_panic_at_unimplemented_subpattern_type() {
r#"
struct S { a: char}
fn main(v: S) {
match v { S{ a } => {} }
match v { S{ a } => { _ = a; } }
match v { S{ a: _x } => {} }
match v { S{ a: 'a' } => {} }
match v { S{..} => {} }
@ -901,7 +903,7 @@ enum E{ A, B }
fn foo() {
match &E::A {
E::A => {}
x => {}
_x => {}
}
}",
);

View File

@ -100,9 +100,9 @@ fn missing_unsafe_diagnostic_with_raw_ptr() {
r#"
fn main() {
let x = &5 as *const usize;
unsafe { let y = *x; }
let z = *x;
} //^^💡 error: this operation is unsafe and requires an unsafe function or block
unsafe { let _y = *x; }
let _z = *x;
} //^^💡 error: this operation is unsafe and requires an unsafe function or block
"#,
)
}
@ -116,13 +116,13 @@ fn missing_unsafe_diagnostic_with_unsafe_call() {
impl HasUnsafe {
unsafe fn unsafe_fn(&self) {
let x = &5 as *const usize;
let y = *x;
let _y = *x;
}
}
unsafe fn unsafe_fn() {
let x = &5 as *const usize;
let y = *x;
let _y = *x;
}
fn main() {
@ -152,10 +152,10 @@ struct Ty {
static mut STATIC_MUT: Ty = Ty { a: 0 };
fn main() {
let x = STATIC_MUT.a;
//^^^^^^^^^^💡 error: this operation is unsafe and requires an unsafe function or block
let _x = STATIC_MUT.a;
//^^^^^^^^^^💡 error: this operation is unsafe and requires an unsafe function or block
unsafe {
let x = STATIC_MUT.a;
let _x = STATIC_MUT.a;
}
}
"#,
@ -187,13 +187,13 @@ fn add_unsafe_block_when_dereferencing_a_raw_pointer() {
r#"
fn main() {
let x = &5 as *const usize;
let z = *x$0;
let _z = *x$0;
}
"#,
r#"
fn main() {
let x = &5 as *const usize;
let z = unsafe { *x };
let _z = unsafe { *x };
}
"#,
);
@ -231,7 +231,7 @@ fn add_unsafe_block_when_calling_unsafe_method() {
impl S {
unsafe fn func(&self) {
let x = &self.0 as *const usize;
let z = *x;
let _z = *x;
}
}
fn main() {
@ -244,7 +244,7 @@ fn main() {
impl S {
unsafe fn func(&self) {
let x = &self.0 as *const usize;
let z = *x;
let _z = *x;
}
}
fn main() {
@ -267,7 +267,7 @@ struct Ty {
static mut STATIC_MUT: Ty = Ty { a: 0 };
fn main() {
let x = STATIC_MUT$0.a;
let _x = STATIC_MUT$0.a;
}
"#,
r#"
@ -278,7 +278,7 @@ struct Ty {
static mut STATIC_MUT: Ty = Ty { a: 0 };
fn main() {
let x = unsafe { STATIC_MUT.a };
let _x = unsafe { STATIC_MUT.a };
}
"#,
)
@ -382,16 +382,16 @@ fn unsafe_expr_as_right_hand_side_of_assignment() {
static mut STATIC_MUT: u8 = 0;
fn main() {
let x;
x = STATIC_MUT$0;
let _x;
_x = STATIC_MUT$0;
}
"#,
r#"
static mut STATIC_MUT: u8 = 0;
fn main() {
let x;
x = unsafe { STATIC_MUT };
let _x;
_x = unsafe { STATIC_MUT };
}
"#,
)
@ -405,14 +405,14 @@ fn unsafe_expr_in_binary_plus() {
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = STATIC_MUT$0 + 1;
let _x = STATIC_MUT$0 + 1;
}
"#,
r#"
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = unsafe { STATIC_MUT } + 1;
let _x = unsafe { STATIC_MUT } + 1;
}
"#,
)
@ -425,14 +425,14 @@ fn ref_to_unsafe_expr() {
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = &STATIC_MUT$0;
let _x = &STATIC_MUT$0;
}
"#,
r#"
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = unsafe { &STATIC_MUT };
let _x = unsafe { &STATIC_MUT };
}
"#,
)
@ -445,14 +445,14 @@ fn ref_ref_to_unsafe_expr() {
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = &&STATIC_MUT$0;
let _x = &&STATIC_MUT$0;
}
"#,
r#"
static mut STATIC_MUT: u8 = 0;
fn main() {
let x = unsafe { &&STATIC_MUT };
let _x = unsafe { &&STATIC_MUT };
}
"#,
)

View File

@ -29,6 +29,7 @@ fn main() {
let a = &X;
let b = *a;
//^ error: cannot move `X` out of reference
_ = b;
}
"#,
);
@ -46,6 +47,7 @@ fn main() {
let b = a.0;
//^ error: cannot move `X` out of reference
let y = a.1;
_ = (b, y);
}
"#,
);
@ -59,8 +61,8 @@ fn move_out_of_static() {
struct X;
fn main() {
static S: X = X;
let s = S;
//^ error: cannot move `X` out of reference
let _s = S;
//^^ error: cannot move `X` out of reference
}
"#,
);
@ -165,7 +167,7 @@ enum X {
fn main() {
let x = &X::Bar;
let c = || match *x {
let _c = || match *x {
X::Foo(t) => t,
_ => 5,
};

View File

@ -74,8 +74,8 @@ fn replace_filter_map_next_with_find_map2() {
r#"
//- minicore: iterators
fn foo() {
let m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: replace filter_map(..).next() with find_map(..)
let _m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: replace filter_map(..).next() with find_map(..)
"#,
);
}
@ -117,7 +117,7 @@ fn replace_filter_map_next_with_find_map_no_diagnostic_if_not_in_chain() {
fn foo() {
let mut m = core::iter::repeat(())
.filter_map(|()| Some(92));
let n = m.next();
let _n = m.next();
}
"#,
);
@ -148,22 +148,22 @@ fn respect_lint_attributes_for_clippy_equivalent() {
fn foo() {
#[allow(clippy::filter_map_next)]
let m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
let _m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
}
#[deny(clippy::filter_map_next)]
fn foo() {
let m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: replace filter_map(..).next() with find_map(..)
let _m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 error: replace filter_map(..).next() with find_map(..)
fn foo() {
let m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: replace filter_map(..).next() with find_map(..)
let _m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: replace filter_map(..).next() with find_map(..)
#[warn(clippy::filter_map_next)]
fn foo() {
let m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 warn: replace filter_map(..).next() with find_map(..)
let _m = core::iter::repeat(()).filter_map(|()| Some(92)).next();
} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 warn: replace filter_map(..).next() with find_map(..)
"#,
);

View File

@ -205,7 +205,7 @@ fn main() {
test(123);
//^^^ 💡 error: expected &i32, found i32
}
fn test(arg: &i32) {}
fn test(_arg: &i32) {}
"#,
);
}
@ -217,13 +217,13 @@ fn test_add_reference_to_int() {
fn main() {
test(123$0);
}
fn test(arg: &i32) {}
fn test(_arg: &i32) {}
"#,
r#"
fn main() {
test(&123);
}
fn test(arg: &i32) {}
fn test(_arg: &i32) {}
"#,
);
}
@ -235,13 +235,13 @@ fn test_add_mutable_reference_to_int() {
fn main() {
test($0123);
}
fn test(arg: &mut i32) {}
fn test(_arg: &mut i32) {}
"#,
r#"
fn main() {
test(&mut 123);
}
fn test(arg: &mut i32) {}
fn test(_arg: &mut i32) {}
"#,
);
}
@ -254,13 +254,13 @@ fn test_add_reference_to_array() {
fn main() {
test($0[1, 2, 3]);
}
fn test(arg: &[i32]) {}
fn test(_arg: &[i32]) {}
"#,
r#"
fn main() {
test(&[1, 2, 3]);
}
fn test(arg: &[i32]) {}
fn test(_arg: &[i32]) {}
"#,
);
}
@ -279,7 +279,7 @@ impl core::ops::Deref for Foo {
fn main() {
test($0Foo);
}
fn test(arg: &Bar) {}
fn test(_arg: &Bar) {}
"#,
r#"
struct Foo;
@ -291,7 +291,7 @@ impl core::ops::Deref for Foo {
fn main() {
test(&Foo);
}
fn test(arg: &Bar) {}
fn test(_arg: &Bar) {}
"#,
);
}
@ -305,7 +305,7 @@ fn main() {
}
struct Test;
impl Test {
fn call_by_ref(&self, arg: &i32) {}
fn call_by_ref(&self, _arg: &i32) {}
}
"#,
r#"
@ -314,7 +314,7 @@ fn main() {
}
struct Test;
impl Test {
fn call_by_ref(&self, arg: &i32) {}
fn call_by_ref(&self, _arg: &i32) {}
}
"#,
);
@ -345,7 +345,7 @@ macro_rules! thousand {
1000_u64
};
}
fn test(foo: &u64) {}
fn test(_foo: &u64) {}
fn main() {
test($0thousand!());
}
@ -356,7 +356,7 @@ macro_rules! thousand {
1000_u64
};
}
fn test(foo: &u64) {}
fn test(_foo: &u64) {}
fn main() {
test(&thousand!());
}
@ -369,12 +369,12 @@ fn test_add_mutable_reference_to_let_stmt() {
check_fix(
r#"
fn main() {
let test: &mut i32 = $0123;
let _test: &mut i32 = $0123;
}
"#,
r#"
fn main() {
let test: &mut i32 = &mut 123;
let _test: &mut i32 = &mut 123;
}
"#,
);
@ -411,7 +411,7 @@ fn const_generic_type_mismatch() {
fn f<const N: u64>() -> Rate<N> { // FIXME: add some error
loop {}
}
fn run(t: Rate<5>) {
fn run(_t: Rate<5>) {
}
fn main() {
run(f()) // FIXME: remove this error
@ -426,7 +426,7 @@ fn const_generic_unknown() {
check_diagnostics(
r#"
pub struct Rate<T, const NOM: u32, const DENOM: u32>(T);
fn run(t: Rate<u32, 1, 1>) {
fn run(_t: Rate<u32, 1, 1>) {
}
fn main() {
run(Rate::<_, _, _>(5));
@ -650,7 +650,7 @@ fn unknown_type_in_function_signature() {
r#"
struct X<T>(T);
fn foo(x: X<Unknown>) {}
fn foo(_x: X<Unknown>) {}
fn test1() {
// Unknown might be `i32`, so we should not emit type mismatch here.
foo(X(42));

View File

@ -142,8 +142,8 @@ fn valid_positions() {
check_diagnostics(
r#"
fn main() {
let x = [(); _];
let y: [(); 10] = [(); _];
let _x = [(); _];
let _y: [(); 10] = [(); _];
_ = 0;
(_,) = (1,);
}

View File

@ -484,7 +484,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10739..10747,
range: 10752..10760,
},
),
tooltip: "",
@ -497,7 +497,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10771..10775,
range: 10784..10788,
},
),
tooltip: "",
@ -522,7 +522,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10739..10747,
range: 10752..10760,
},
),
tooltip: "",
@ -535,7 +535,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10771..10775,
range: 10784..10788,
},
),
tooltip: "",
@ -560,7 +560,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10739..10747,
range: 10752..10760,
},
),
tooltip: "",
@ -573,7 +573,7 @@ fn main() {
file_id: FileId(
1,
),
range: 10771..10775,
range: 10784..10788,
},
),
tooltip: "",

View File

@ -489,7 +489,7 @@ impl<T, I> Index<I> for [T]
I: SliceIndex<[T]>,
{
type Output = I::Output;
fn index(&self, index: I) -> &I::Output {
fn index(&self, _index: I) -> &I::Output {
loop {}
}
}
@ -497,7 +497,7 @@ impl<T, I> IndexMut<I> for [T]
where
I: SliceIndex<[T]>,
{
fn index_mut(&mut self, index: I) -> &mut I::Output {
fn index_mut(&mut self, _index: I) -> &mut I::Output {
loop {}
}
}
@ -507,7 +507,7 @@ fn index_mut(&mut self, index: I) -> &mut I::Output {
I: SliceIndex<[T]>,
{
type Output = I::Output;
fn index(&self, index: I) -> &I::Output {
fn index(&self, _index: I) -> &I::Output {
loop {}
}
}
@ -515,7 +515,7 @@ fn index(&self, index: I) -> &I::Output {
where
I: SliceIndex<[T]>,
{
fn index_mut(&mut self, index: I) -> &mut I::Output {
fn index_mut(&mut self, _index: I) -> &mut I::Output {
loop {}
}
}
@ -863,17 +863,17 @@ pub mod fmt {
pub struct DebugTuple;
pub struct DebugStruct;
impl Formatter<'_> {
pub fn debug_tuple(&mut self, name: &str) -> DebugTuple {
pub fn debug_tuple(&mut self, _name: &str) -> DebugTuple {
DebugTuple
}
pub fn debug_struct(&mut self, name: &str) -> DebugStruct {
pub fn debug_struct(&mut self, _name: &str) -> DebugStruct {
DebugStruct
}
}
impl DebugTuple {
pub fn field(&mut self, value: &dyn Debug) -> &mut Self {
pub fn field(&mut self, _value: &dyn Debug) -> &mut Self {
self
}
@ -883,7 +883,7 @@ pub fn finish(&mut self) -> Result {
}
impl DebugStruct {
pub fn field(&mut self, name: &str, value: &dyn Debug) -> &mut Self {
pub fn field(&mut self, _name: &str, _value: &dyn Debug) -> &mut Self {
self
}
@ -996,7 +996,7 @@ macro_rules! impl_debug {
($($t:ty)*) => {
$(
impl const Debug for $t {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
fn fmt(&self, _f: &mut Formatter<'_>) -> Result {
Ok(())
}
}
@ -1012,7 +1012,7 @@ fn fmt(&self, f: &mut Formatter<'_>) -> Result {
}
impl<T: Debug> Debug for [T] {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
fn fmt(&self, _f: &mut Formatter<'_>) -> Result {
Ok(())
}
}
@ -1062,7 +1062,7 @@ pub const fn as_ref(&self) -> Option<&T> {
}
}
pub fn and<U>(self, optb: Option<U>) -> Option<U> {
pub fn and<U>(self, _optb: Option<U>) -> Option<U> {
loop {}
}
pub fn unwrap_or(self, default: T) -> T {
@ -1080,25 +1080,25 @@ pub const fn ok_or<E>(self, err: E) -> Result<T, E> {
}
// endregion:result
// region:fn
pub fn and_then<U, F>(self, f: F) -> Option<U>
pub fn and_then<U, F>(self, _f: F) -> Option<U>
where
F: FnOnce(T) -> Option<U>,
{
loop {}
}
pub fn unwrap_or_else<F>(self, f: F) -> T
pub fn unwrap_or_else<F>(self, _f: F) -> T
where
F: FnOnce() -> T,
{
loop {}
}
pub fn map_or<U, F>(self, default: U, f: F) -> U
pub fn map_or<U, F>(self, _default: U, _f: F) -> U
where
F: FnOnce(T) -> U,
{
loop {}
}
pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
pub fn map_or_else<U, D, F>(self, _default: D, _f: F) -> U
where
D: FnOnce() -> U,
F: FnOnce(T) -> U,
@ -1129,7 +1129,7 @@ pub struct Pin<P> {
pointer: P,
}
impl<P> Pin<P> {
pub fn new(pointer: P) -> Pin<P> {
pub fn new(_pointer: P) -> Pin<P> {
loop {}
}
}
@ -1226,7 +1226,7 @@ fn next(&mut self) -> Option<B> {
mod sources {
mod repeat {
pub fn repeat<T>(elt: T) -> Repeat<T> {
pub fn repeat<T>(_elt: T) -> Repeat<T> {
loop {}
}
@ -1266,7 +1266,7 @@ fn by_ref(&mut self) -> &mut Self
fn take(self, n: usize) -> crate::iter::Take<Self> {
loop {}
}
fn filter_map<B, F>(self, f: F) -> crate::iter::FilterMap<Self, F>
fn filter_map<B, F>(self, _f: F) -> crate::iter::FilterMap<Self, F>
where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
@ -1337,7 +1337,7 @@ mod panic {
mod panicking {
#[lang = "panic_fmt"]
pub const fn panic_fmt(fmt: crate::fmt::Arguments<'_>) -> ! {
pub const fn panic_fmt(_fmt: crate::fmt::Arguments<'_>) -> ! {
loop {}
}
}