Prune unused parameters.
This commit is contained in:
parent
b69cd73b7b
commit
04386f4217
@ -174,9 +174,7 @@ pub fn lookup_in_trait<'a, 'tcx>(
|
||||
m_name: ast::Name, // The name `b`.
|
||||
trait_did: DefId, // The trait to limit the lookup to.
|
||||
self_ty: ty::t, // The type of `a`.
|
||||
supplied_tps: &'a [ty::t], // The list of types X, Y, ... .
|
||||
autoderef_receiver: AutoderefReceiverFlag,
|
||||
report_statics: StaticMethodsFlag)
|
||||
supplied_tps: &'a [ty::t]) // The list of types X, Y, ... .
|
||||
-> Option<MethodCallee> {
|
||||
let mut lcx = LookupContext {
|
||||
fcx: fcx,
|
||||
@ -189,8 +187,8 @@ pub fn lookup_in_trait<'a, 'tcx>(
|
||||
extension_candidates: Vec::new(),
|
||||
deref_args: check::DoDerefArgs,
|
||||
check_traits: CheckTraitsOnly,
|
||||
autoderef_receiver: autoderef_receiver,
|
||||
report_statics: report_statics,
|
||||
autoderef_receiver: DontAutoderefReceiver,
|
||||
report_statics: IgnoreStaticMethods,
|
||||
};
|
||||
|
||||
debug!("method lookup_in_trait(self_ty={}, self_expr={})",
|
||||
|
@ -2117,9 +2117,7 @@ fn try_overloaded_call<'a>(fcx: &FnCtxt,
|
||||
method_name,
|
||||
function_trait,
|
||||
callee_type,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods) {
|
||||
[]) {
|
||||
None => continue,
|
||||
Some(method_callee) => method_callee,
|
||||
};
|
||||
@ -2160,7 +2158,7 @@ fn try_overloaded_deref(fcx: &FnCtxt,
|
||||
(PreferMutLvalue, Some(trait_did)) => {
|
||||
method::lookup_in_trait(fcx, span, base_expr.map(|x| &*x),
|
||||
token::intern("deref_mut"), trait_did,
|
||||
base_ty, [], DontAutoderefReceiver, IgnoreStaticMethods)
|
||||
base_ty, [])
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
@ -2170,7 +2168,7 @@ fn try_overloaded_deref(fcx: &FnCtxt,
|
||||
(None, Some(trait_did)) => {
|
||||
method::lookup_in_trait(fcx, span, base_expr.map(|x| &*x),
|
||||
token::intern("deref"), trait_did,
|
||||
base_ty, [], DontAutoderefReceiver, IgnoreStaticMethods)
|
||||
base_ty, [])
|
||||
}
|
||||
(method, _) => method
|
||||
};
|
||||
@ -2231,9 +2229,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
|
||||
token::intern(method_name),
|
||||
trait_did,
|
||||
base_ty,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods)
|
||||
[])
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
@ -2256,9 +2252,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
|
||||
token::intern(method_name),
|
||||
trait_did,
|
||||
base_ty,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods)
|
||||
[])
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
@ -2314,9 +2308,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
|
||||
token::intern("index_mut"),
|
||||
trait_did,
|
||||
base_ty,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods)
|
||||
[])
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
@ -2330,9 +2322,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
|
||||
token::intern("index"),
|
||||
trait_did,
|
||||
base_ty,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods)
|
||||
[])
|
||||
}
|
||||
(method, _) => method,
|
||||
};
|
||||
@ -2376,9 +2366,7 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
|
||||
token::intern("next"),
|
||||
trait_did,
|
||||
expr_type,
|
||||
[],
|
||||
DontAutoderefReceiver,
|
||||
IgnoreStaticMethods);
|
||||
[]);
|
||||
|
||||
// Regardless of whether the lookup succeeds, check the method arguments
|
||||
// so that we have *some* type for each argument.
|
||||
@ -3069,13 +3057,11 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
|
||||
trait_did: Option<ast::DefId>,
|
||||
lhs: &'a ast::Expr,
|
||||
rhs: Option<&P<ast::Expr>>,
|
||||
autoderef_receiver: AutoderefReceiverFlag,
|
||||
unbound_method: ||) -> ty::t {
|
||||
let method = match trait_did {
|
||||
Some(trait_did) => {
|
||||
method::lookup_in_trait(fcx, op_ex.span, Some(lhs), opname,
|
||||
trait_did, lhs_ty, &[], autoderef_receiver,
|
||||
IgnoreStaticMethods)
|
||||
trait_did, lhs_ty, &[])
|
||||
}
|
||||
None => None
|
||||
};
|
||||
@ -3249,7 +3235,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
|
||||
}
|
||||
};
|
||||
lookup_op_method(fcx, ex, lhs_resolved_t, token::intern(name),
|
||||
trait_did, lhs_expr, Some(rhs), DontAutoderefReceiver, || {
|
||||
trait_did, lhs_expr, Some(rhs), || {
|
||||
fcx.type_error_message(ex.span, |actual| {
|
||||
format!("binary operation `{}` cannot be applied to type `{}`",
|
||||
ast_util::binop_to_string(op),
|
||||
@ -3266,7 +3252,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
|
||||
rhs_expr: &ast::Expr,
|
||||
rhs_t: ty::t) -> ty::t {
|
||||
lookup_op_method(fcx, ex, rhs_t, token::intern(mname),
|
||||
trait_did, rhs_expr, None, DontAutoderefReceiver, || {
|
||||
trait_did, rhs_expr, None, || {
|
||||
fcx.type_error_message(ex.span, |actual| {
|
||||
format!("cannot apply unary operator `{}` to type `{}`",
|
||||
op_str, actual)
|
||||
|
Loading…
x
Reference in New Issue
Block a user