Skip to content

Commit

Permalink
Prune unused parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Oct 21, 2014
1 parent b69cd73 commit 04386f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
8 changes: 3 additions & 5 deletions src/librustc/middle/typeck/check/method.rs
Expand Up @@ -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,
Expand All @@ -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={})",
Expand Down
36 changes: 11 additions & 25 deletions src/librustc/middle/typeck/check/mod.rs
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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
};
Expand All @@ -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
};
Expand Down Expand Up @@ -2231,9 +2229,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
token::intern(method_name),
trait_did,
base_ty,
[],
DontAutoderefReceiver,
IgnoreStaticMethods)
[])
}
_ => None,
}
Expand All @@ -2256,9 +2252,7 @@ fn try_overloaded_slice(fcx: &FnCtxt,
token::intern(method_name),
trait_did,
base_ty,
[],
DontAutoderefReceiver,
IgnoreStaticMethods)
[])
}
_ => None,
}
Expand Down Expand Up @@ -2314,9 +2308,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
token::intern("index_mut"),
trait_did,
base_ty,
[],
DontAutoderefReceiver,
IgnoreStaticMethods)
[])
}
_ => None,
};
Expand All @@ -2330,9 +2322,7 @@ fn try_overloaded_index(fcx: &FnCtxt,
token::intern("index"),
trait_did,
base_ty,
[],
DontAutoderefReceiver,
IgnoreStaticMethods)
[])
}
(method, _) => method,
};
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -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),
Expand All @@ -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)
Expand Down

0 comments on commit 04386f4

Please sign in to comment.