mirror of https://github.com/rust-lang/rust.git
Remove more anonymous trait method parameters
This commit is contained in:
parent
13157c4ebc
commit
affb8ee831
|
@ -614,7 +614,7 @@ use std::mem::transmute;
|
|||
struct Foo<T>(Vec<T>);
|
||||
|
||||
trait MyTransmutableType: Sized {
|
||||
fn transmute(Vec<Self>) -> Foo<Self>;
|
||||
fn transmute(_: Vec<Self>) -> Foo<Self>;
|
||||
}
|
||||
|
||||
impl MyTransmutableType for u8 {
|
||||
|
|
|
@ -837,7 +837,7 @@ impl Something {} // ok!
|
|||
trait Foo {
|
||||
type N;
|
||||
|
||||
fn bar(Self::N); // ok!
|
||||
fn bar(_: Self::N); // ok!
|
||||
}
|
||||
|
||||
// or:
|
||||
|
|
|
@ -2476,7 +2476,7 @@ trait T2 {
|
|||
type Bar;
|
||||
|
||||
// error: Baz is used but not declared
|
||||
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
|
||||
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -2498,7 +2498,7 @@ trait T2 {
|
|||
type Baz; // we declare `Baz` in our trait.
|
||||
|
||||
// and now we can use it here:
|
||||
fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
|
||||
fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
|
||||
}
|
||||
```
|
||||
"##,
|
||||
|
|
|
@ -25,7 +25,7 @@ pub trait Sized {
|
|||
trait Add<RHS=Self> {
|
||||
type Output;
|
||||
|
||||
fn add(self, RHS) -> Self::Output;
|
||||
fn add(self, _: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
fn ice<A>(a: A) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
trait Deserializer<'a> { }
|
||||
|
||||
trait Deserializable {
|
||||
fn deserialize_token<'a, D: Deserializer<'a>>(D, &'a str) -> Self;
|
||||
fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
|
||||
}
|
||||
|
||||
impl<'a, T: Deserializable> Deserializable for &'a str {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait Set<T> {
|
||||
fn contains(&self, T) -> bool;
|
||||
fn set(&mut self, T);
|
||||
fn contains(&self, _: T) -> bool;
|
||||
fn set(&mut self, _: T);
|
||||
}
|
||||
|
||||
impl<'a, T, S> Set<&'a [T]> for S where
|
||||
|
|
|
@ -22,7 +22,7 @@ pub trait Subscriber {
|
|||
|
||||
pub trait Publisher<'a> {
|
||||
type Output;
|
||||
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
}
|
||||
|
||||
pub trait Processor<'a> : Subscriber + Publisher<'a> { }
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#![feature(conservative_impl_trait)]
|
||||
|
||||
trait Foo {
|
||||
fn foo(fn(u8) -> ()); //~ NOTE type in trait
|
||||
fn bar(Option<u8>); //~ NOTE type in trait
|
||||
fn baz((u8, u16)); //~ NOTE type in trait
|
||||
fn foo(_: fn(u8) -> ()); //~ NOTE type in trait
|
||||
fn bar(_: Option<u8>); //~ NOTE type in trait
|
||||
fn baz(_: (u8, u16)); //~ NOTE type in trait
|
||||
fn qux() -> u8; //~ NOTE type in trait
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// type parameters on a trait correctly.
|
||||
|
||||
trait Tr<T> : Sized {
|
||||
fn op(T) -> Self;
|
||||
fn op(_: T) -> Self;
|
||||
}
|
||||
|
||||
trait A: Tr<Self> {
|
||||
|
|
|
@ -19,7 +19,7 @@ trait Getter<T> {
|
|||
}
|
||||
|
||||
trait Setter<T> {
|
||||
fn get(&self, T);
|
||||
fn get(&self, _: T);
|
||||
}
|
||||
|
||||
#[rustc_variance]
|
||||
|
|
|
@ -26,7 +26,7 @@ pub trait Subscriber {
|
|||
|
||||
pub trait Publisher<'a> {
|
||||
type Output;
|
||||
fn subscribe(&mut self, Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
|
||||
}
|
||||
|
||||
pub trait Processor<'a> : Subscriber + Publisher<'a> { }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![crate_type = "lib"]
|
||||
|
||||
pub trait Positioned {
|
||||
fn SetX(&mut self, isize);
|
||||
fn SetX(&mut self, _: isize);
|
||||
fn X(&self) -> isize;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub trait FromBuf<'a> {
|
||||
fn from_buf(&'a [u8]) -> Self;
|
||||
fn from_buf(_: &'a [u8]) -> Self;
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ pub fn main() {
|
|||
}
|
||||
|
||||
trait Named {
|
||||
fn new(&'static str) -> Self;
|
||||
fn new(_: &'static str) -> Self;
|
||||
fn name(&self) -> &str;
|
||||
}
|
||||
|
||||
|
@ -932,9 +932,9 @@ trait Context {
|
|||
}
|
||||
|
||||
trait PrePost<T> {
|
||||
fn pre(&mut self, &T);
|
||||
fn post(&mut self, &T);
|
||||
fn hit_limit(&mut self, &T);
|
||||
fn pre(&mut self, _: &T);
|
||||
fn post(&mut self, _: &T);
|
||||
fn hit_limit(&mut self, _: &T);
|
||||
}
|
||||
|
||||
trait Children<'a> {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// pretty-expanded FIXME #23616
|
||||
|
||||
trait Foo {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn quux(u8) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// pretty-expanded FIXME #23616
|
||||
|
||||
trait Foo {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn bar(&self, isize) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> {
|
|||
}
|
||||
|
||||
trait IntoMatcher<'a, T> {
|
||||
fn into_matcher(self, &'a str) -> T;
|
||||
fn into_matcher(self, _: &'a str) -> T;
|
||||
}
|
||||
|
||||
impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub trait Handler {
|
||||
fn handle(&self, &mut String);
|
||||
fn handle(&self, _: &mut String);
|
||||
}
|
||||
|
||||
impl<F> Handler for F where F: for<'a, 'b> Fn(&'a mut String) {
|
||||
|
|
|
@ -23,7 +23,7 @@ fn foo<'a>(s: &'a str) {
|
|||
|
||||
trait IntoRef<'a> {
|
||||
type T: Clone;
|
||||
fn into_ref(self, &'a str) -> Self::T;
|
||||
fn into_ref(self, _: &'a str) -> Self::T;
|
||||
}
|
||||
|
||||
impl<'a> IntoRef<'a> for () {
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Make sure several unnamed function arguments don't conflict with each other
|
||||
// Make sure several unnamed function parameters don't conflict with each other
|
||||
|
||||
trait Tr {
|
||||
#[allow(anonymous_parameters)]
|
||||
fn f(u8, u8) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
use std::ops::Add;
|
||||
|
||||
trait Positioned<S> {
|
||||
fn SetX(&mut self, S);
|
||||
fn SetX(&mut self, _: S);
|
||||
fn X(&self) -> S;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
trait Positioned {
|
||||
fn SetX(&mut self, isize);
|
||||
fn SetX(&mut self, _: isize);
|
||||
fn X(&self) -> isize;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn main() {
|
|||
let _id: &Mat2<f64> = &Matrix::identity(1.0);
|
||||
}
|
||||
|
||||
pub trait Index<Index,Result> { fn get(&self, Index) -> Result { panic!() } }
|
||||
pub trait Index<Index,Result> { fn get(&self, _: Index) -> Result { panic!() } }
|
||||
pub trait Dimensional<T>: Index<usize, T> { }
|
||||
|
||||
pub struct Mat2<T> { x: T }
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
trait Graph<Node, Edge> {
|
||||
fn f(&self, Edge);
|
||||
fn g(&self, Node);
|
||||
|
||||
fn f(&self, _: Edge);
|
||||
fn g(&self, _: Node);
|
||||
}
|
||||
|
||||
impl<E> Graph<isize, E> for HashMap<isize, isize> {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
pub trait OpInt { fn call(&mut self, isize, isize) -> isize; }
|
||||
pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; }
|
||||
|
||||
impl<F> OpInt for F where F: FnMut(isize, isize) -> isize {
|
||||
fn call(&mut self, a:isize, b:isize) -> isize {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
pub trait bomb { fn boom(&self, Ident); }
|
||||
pub trait bomb { fn boom(&self, _: Ident); }
|
||||
pub struct S;
|
||||
impl bomb for S { fn boom(&self, _: Ident) { } }
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ fn make_val<T:MakerTrait>() -> T {
|
|||
}
|
||||
|
||||
trait RefMakerTrait<'q> {
|
||||
fn mk(Self) -> &'q Self;
|
||||
fn mk(_: Self) -> &'q Self;
|
||||
}
|
||||
|
||||
fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
use std::ops::Add;
|
||||
|
||||
trait Positioned<S> {
|
||||
fn SetX(&mut self, S);
|
||||
fn SetX(&mut self, _: S);
|
||||
fn X(&self) -> S;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
pub trait MyNum {
|
||||
fn from_int(isize) -> Self;
|
||||
fn from_int(_: isize) -> Self;
|
||||
}
|
||||
|
||||
pub trait NumExt: MyNum { }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
pub trait MyEq {}
|
||||
|
||||
pub trait MyNum {
|
||||
fn from_int(isize) -> Self;
|
||||
fn from_int(_: isize) -> Self;
|
||||
}
|
||||
|
||||
pub trait NumExt: MyEq + MyNum { }
|
||||
|
|
|
@ -41,7 +41,7 @@ impl<A1, A2, A3> Impl<A1, A2, A3> {
|
|||
enum Type<T> { Constant(T) }
|
||||
|
||||
trait Trait<K,V> {
|
||||
fn method(&self,Type<(K,V)>) -> isize;
|
||||
fn method(&self, _: Type<(K,V)>) -> isize;
|
||||
}
|
||||
|
||||
impl<V> Trait<u8,V> for () {
|
||||
|
|
|
@ -15,10 +15,10 @@ trait Bound {
|
|||
}
|
||||
|
||||
trait Trait {
|
||||
fn a<T>(&self, T) where T: Bound;
|
||||
fn b<T>(&self, T) where T: Bound;
|
||||
fn c<T: Bound>(&self, T);
|
||||
fn d<T: Bound>(&self, T);
|
||||
fn a<T>(&self, _: T) where T: Bound;
|
||||
fn b<T>(&self, _: T) where T: Bound;
|
||||
fn c<T: Bound>(&self, _: T);
|
||||
fn d<T: Bound>(&self, _: T);
|
||||
}
|
||||
|
||||
impl Trait for bool {
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
trait CtxtFn {
|
||||
fn f8(self, usize) -> usize;
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f8(self, _: usize) -> usize;
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
trait OtherTrait {
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
// Note: this trait is not implemented, but we can't really tell
|
||||
|
@ -26,7 +26,7 @@ trait OtherTrait {
|
|||
// candidate. This seems not unreasonable -- perhaps the user meant to
|
||||
// implement it, after all.
|
||||
trait UnusedTrait {
|
||||
fn f9(usize) -> usize; //~ NOTE candidate
|
||||
fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
}
|
||||
|
||||
impl CtxtFn for usize {
|
||||
|
|
|
@ -8,20 +8,20 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope
|
|||
note: candidate #1 is defined in the trait `CtxtFn`
|
||||
--> $DIR/issue-7575.rs:16:5
|
||||
|
|
||||
16 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
16 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead
|
||||
note: candidate #2 is defined in the trait `OtherTrait`
|
||||
--> $DIR/issue-7575.rs:20:5
|
||||
|
|
||||
20 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
20 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead
|
||||
note: candidate #3 is defined in the trait `UnusedTrait`
|
||||
--> $DIR/issue-7575.rs:29:5
|
||||
|
|
||||
29 | fn f9(usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
29 | fn f9(_: usize) -> usize; //~ NOTE candidate
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `f9`, perhaps you need to implement one of them:
|
||||
|
|
Loading…
Reference in New Issue