Skip to content

Commit affb8ee

Browse files
committed
Remove more anonymous trait method parameters
1 parent 13157c4 commit affb8ee

34 files changed

+54
-52
lines changed

src/librustc/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ use std::mem::transmute;
614614
struct Foo<T>(Vec<T>);
615615
616616
trait MyTransmutableType: Sized {
617-
fn transmute(Vec<Self>) -> Foo<Self>;
617+
fn transmute(_: Vec<Self>) -> Foo<Self>;
618618
}
619619
620620
impl MyTransmutableType for u8 {

src/librustc_resolve/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ impl Something {} // ok!
837837
trait Foo {
838838
type N;
839839
840-
fn bar(Self::N); // ok!
840+
fn bar(_: Self::N); // ok!
841841
}
842842
843843
// or:

src/librustc_typeck/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,7 +2476,7 @@ trait T2 {
24762476
type Bar;
24772477
24782478
// error: Baz is used but not declared
2479-
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
2479+
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
24802480
}
24812481
```
24822482
@@ -2498,7 +2498,7 @@ trait T2 {
24982498
type Baz; // we declare `Baz` in our trait.
24992499
25002500
// and now we can use it here:
2501-
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
2501+
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
25022502
}
25032503
```
25042504
"##,

src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait Sized {
2525
trait Add<RHS=Self> {
2626
type Output;
2727

28-
fn add(self, RHS) -> Self::Output;
28+
fn add(self, _: RHS) -> Self::Output;
2929
}
3030

3131
fn ice<A>(a: A) {

src/test/compile-fail/issue-13853-5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
trait Deserializer<'a> { }
1212

1313
trait Deserializable {
14-
fn deserialize_token<'a, D: Deserializer<'a>>(D, &'a str) -> Self;
14+
fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
1515
}
1616

1717
impl<'a, T: Deserializable> Deserializable for &'a str {

src/test/compile-fail/issue-18400.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
trait Set<T> {
12-
fn contains(&self, T) -> bool;
13-
fn set(&mut self, T);
12+
fn contains(&self, _: T) -> bool;
13+
fn set(&mut self, _: T);
1414
}
1515

1616
impl<'a, T, S> Set<&'a [T]> for S where

src/test/compile-fail/issue-20831-debruijn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub trait Subscriber {
2222

2323
pub trait Publisher<'a> {
2424
type Output;
25-
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
25+
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
2626
}
2727

2828
pub trait Processor<'a> : Subscriber + Publisher<'a> { }

src/test/compile-fail/issue-35869.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#![feature(conservative_impl_trait)]
1212

1313
trait Foo {
14-
fn foo(fn(u8) -> ()); //~ NOTE type in trait
15-
fn bar(Option<u8>); //~ NOTE type in trait
16-
fn baz((u8, u16)); //~ NOTE type in trait
14+
fn foo(_: fn(u8) -> ()); //~ NOTE type in trait
15+
fn bar(_: Option<u8>); //~ NOTE type in trait
16+
fn baz(_: (u8, u16)); //~ NOTE type in trait
1717
fn qux() -> u8; //~ NOTE type in trait
1818
}
1919

src/test/compile-fail/type-params-in-different-spaces-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// type parameters on a trait correctly.
1313

1414
trait Tr<T> : Sized {
15-
fn op(T) -> Self;
15+
fn op(_: T) -> Self;
1616
}
1717

1818
trait A: Tr<Self> {

src/test/compile-fail/variance-trait-bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait Getter<T> {
1919
}
2020

2121
trait Setter<T> {
22-
fn get(&self, T);
22+
fn get(&self, _: T);
2323
}
2424

2525
#[rustc_variance]

src/test/run-pass/associated-types-projection-in-object-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub trait Subscriber {
2626

2727
pub trait Publisher<'a> {
2828
type Output;
29-
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
29+
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
3030
}
3131

3232
pub trait Processor<'a> : Subscriber + Publisher<'a> { }

src/test/run-pass/auxiliary/issue_3979_traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![crate_type = "lib"]
1414

1515
pub trait Positioned {
16-
fn SetX(&mut self, isize);
16+
fn SetX(&mut self, _: isize);
1717
fn X(&self) -> isize;
1818
}
1919

src/test/run-pass/auxiliary/xcrate-trait-lifetime-param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
pub trait FromBuf<'a> {
12-
fn from_buf(&'a [u8]) -> Self;
12+
fn from_buf(_: &'a [u8]) -> Self;
1313
}

src/test/run-pass/dropck_legal_cycles.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ pub fn main() {
442442
}
443443

444444
trait Named {
445-
fn new(&'static str) -> Self;
445+
fn new(_: &'static str) -> Self;
446446
fn name(&self) -> &str;
447447
}
448448

@@ -932,9 +932,9 @@ trait Context {
932932
}
933933

934934
trait PrePost<T> {
935-
fn pre(&mut self, &T);
936-
fn post(&mut self, &T);
937-
fn hit_limit(&mut self, &T);
935+
fn pre(&mut self, _: &T);
936+
fn post(&mut self, _: &T);
937+
fn hit_limit(&mut self, _: &T);
938938
}
939939

940940
trait Children<'a> {

src/test/run-pass/issue-13105.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// pretty-expanded FIXME #23616
1212

1313
trait Foo {
14+
#[allow(anonymous_parameters)]
1415
fn quux(u8) {}
1516
}
1617

src/test/run-pass/issue-13775.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// pretty-expanded FIXME #23616
1212

1313
trait Foo {
14+
#[allow(anonymous_parameters)]
1415
fn bar(&self, isize) {}
1516
}
1617

src/test/run-pass/issue-14919.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> {
2626
}
2727

2828
trait IntoMatcher<'a, T> {
29-
fn into_matcher(self, &'a str) -> T;
29+
fn into_matcher(self, _: &'a str) -> T;
3030
}
3131

3232
impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b {

src/test/run-pass/issue-19098.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
pub trait Handler {
12-
fn handle(&self, &mut String);
12+
fn handle(&self, _: &mut String);
1313
}
1414

1515
impl<F> Handler for F where F: for<'a, 'b> Fn(&'a mut String) {

src/test/run-pass/issue-21726.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn foo<'a>(s: &'a str) {
2323

2424
trait IntoRef<'a> {
2525
type T: Clone;
26-
fn into_ref(self, &'a str) -> Self::T;
26+
fn into_ref(self, _: &'a str) -> Self::T;
2727
}
2828

2929
impl<'a> IntoRef<'a> for () {

src/test/run-pass/issue-34074.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Make sure several unnamed function arguments don't conflict with each other
11+
// Make sure several unnamed function parameters don't conflict with each other
1212

1313
trait Tr {
14+
#[allow(anonymous_parameters)]
1415
fn f(u8, u8) {}
1516
}
1617

src/test/run-pass/issue-3979-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use std::ops::Add;
1313

1414
trait Positioned<S> {
15-
fn SetX(&mut self, S);
15+
fn SetX(&mut self, _: S);
1616
fn X(&self) -> S;
1717
}
1818

src/test/run-pass/issue-3979.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
trait Positioned {
13-
fn SetX(&mut self, isize);
13+
fn SetX(&mut self, _: isize);
1414
fn X(&self) -> isize;
1515
}
1616

src/test/run-pass/issue-4107.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn main() {
1313
let _id: &Mat2<f64> = &Matrix::identity(1.0);
1414
}
1515

16-
pub trait Index<Index,Result> { fn get(&self, Index) -> Result { panic!() } }
16+
pub trait Index<Index,Result> { fn get(&self, _: Index) -> Result { panic!() } }
1717
pub trait Dimensional<T>: Index<usize, T> { }
1818

1919
pub struct Mat2<T> { x: T }

src/test/run-pass/issue-6128.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
use std::collections::HashMap;
1515

1616
trait Graph<Node, Edge> {
17-
fn f(&self, Edge);
18-
fn g(&self, Node);
19-
17+
fn f(&self, _: Edge);
18+
fn g(&self, _: Node);
2019
}
2120

2221
impl<E> Graph<isize, E> for HashMap<isize, isize> {

src/test/run-pass/issue-6157.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// pretty-expanded FIXME #23616
1212

13-
pub trait OpInt { fn call(&mut self, isize, isize) -> isize; }
13+
pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; }
1414

1515
impl<F> OpInt for F where F: FnMut(isize, isize) -> isize {
1616
fn call(&mut self, a:isize, b:isize) -> isize {

src/test/run-pass/issue-9129.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![allow(unknown_features)]
1414
#![feature(box_syntax)]
1515

16-
pub trait bomb { fn boom(&self, Ident); }
16+
pub trait bomb { fn boom(&self, _: Ident); }
1717
pub struct S;
1818
impl bomb for S { fn boom(&self, _: Ident) { } }
1919

src/test/run-pass/regions-early-bound-trait-param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn make_val<T:MakerTrait>() -> T {
6363
}
6464

6565
trait RefMakerTrait<'q> {
66-
fn mk(Self) -> &'q Self;
66+
fn mk(_: Self) -> &'q Self;
6767
}
6868

6969
fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T {

src/test/run-pass/supertrait-default-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use std::ops::Add;
1515

1616
trait Positioned<S> {
17-
fn SetX(&mut self, S);
17+
fn SetX(&mut self, _: S);
1818
fn X(&self) -> S;
1919
}
2020

src/test/run-pass/trait-inheritance-static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
pub trait MyNum {
13-
fn from_int(isize) -> Self;
13+
fn from_int(_: isize) -> Self;
1414
}
1515

1616
pub trait NumExt: MyNum { }

src/test/run-pass/trait-inheritance-static2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
pub trait MyEq {}
1212

1313
pub trait MyNum {
14-
fn from_int(isize) -> Self;
14+
fn from_int(_: isize) -> Self;
1515
}
1616

1717
pub trait NumExt: MyEq + MyNum { }

src/test/run-pass/trait-object-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<A1, A2, A3> Impl<A1, A2, A3> {
4141
enum Type<T> { Constant(T) }
4242

4343
trait Trait<K,V> {
44-
fn method(&self,Type<(K,V)>) -> isize;
44+
fn method(&self, _: Type<(K,V)>) -> isize;
4545
}
4646

4747
impl<V> Trait<u8,V> for () {

src/test/run-pass/where-clause-bounds-inconsistency.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ trait Bound {
1515
}
1616

1717
trait Trait {
18-
fn a<T>(&self, T) where T: Bound;
19-
fn b<T>(&self, T) where T: Bound;
20-
fn c<T: Bound>(&self, T);
21-
fn d<T: Bound>(&self, T);
18+
fn a<T>(&self, _: T) where T: Bound;
19+
fn b<T>(&self, _: T) where T: Bound;
20+
fn c<T: Bound>(&self, _: T);
21+
fn d<T: Bound>(&self, _: T);
2222
}
2323

2424
impl Trait for bool {

src/test/ui/span/issue-7575.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// ignore-tidy-linelength
1313

1414
trait CtxtFn {
15-
fn f8(self, usize) -> usize;
16-
fn f9(usize) -> usize; //~ NOTE candidate
15+
fn f8(self, _: usize) -> usize;
16+
fn f9(_: usize) -> usize; //~ NOTE candidate
1717
}
1818

1919
trait OtherTrait {
20-
fn f9(usize) -> usize; //~ NOTE candidate
20+
fn f9(_: usize) -> usize; //~ NOTE candidate
2121
}
2222

2323
// Note: this trait is not implemented, but we can't really tell
@@ -26,7 +26,7 @@ trait OtherTrait {
2626
// candidate. This seems not unreasonable -- perhaps the user meant to
2727
// implement it, after all.
2828
trait UnusedTrait {
29-
fn f9(usize) -> usize; //~ NOTE candidate
29+
fn f9(_: usize) -> usize; //~ NOTE candidate
3030
}
3131

3232
impl CtxtFn for usize {

src/test/ui/span/issue-7575.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope
88
note: candidate #1 is defined in the trait `CtxtFn`
99
--> $DIR/issue-7575.rs:16:5
1010
|
11-
16 | fn f9(usize) -> usize; //~ NOTE candidate
12-
| ^^^^^^^^^^^^^^^^^^^^^^
11+
16 | fn f9(_: usize) -> usize; //~ NOTE candidate
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1313
= help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead
1414
note: candidate #2 is defined in the trait `OtherTrait`
1515
--> $DIR/issue-7575.rs:20:5
1616
|
17-
20 | fn f9(usize) -> usize; //~ NOTE candidate
18-
| ^^^^^^^^^^^^^^^^^^^^^^
17+
20 | fn f9(_: usize) -> usize; //~ NOTE candidate
18+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1919
= help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead
2020
note: candidate #3 is defined in the trait `UnusedTrait`
2121
--> $DIR/issue-7575.rs:29:5
2222
|
23-
29 | fn f9(usize) -> usize; //~ NOTE candidate
24-
| ^^^^^^^^^^^^^^^^^^^^^^
23+
29 | fn f9(_: usize) -> usize; //~ NOTE candidate
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2525
= help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead
2626
= help: items from traits can only be used if the trait is implemented and in scope
2727
= note: the following traits define an item `f9`, perhaps you need to implement one of them:

0 commit comments

Comments
 (0)