diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-19 10:41:36 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2017-02-20 11:40:01 -0500 |
| commit | de2f7e15ba6db2846c80c7ad4ffe391f2c5a4311 (patch) | |
| tree | 993ecee2701a1e151f44661eb2bfab3bf3bde04f /src | |
| parent | 7e0c3de4c473c3779046951abec46517fdba8cc9 (diff) | |
Rewrite `match` to use combinators.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/traits/error_reporting.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 411e986f62d..a9f3c54bd73 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -535,14 +535,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return; } else { let trait_ref = trait_predicate.to_poly_trait_ref(); - let (post_message, pre_message) = match self.get_parent_trait_ref( - &obligation.cause.code) - { - Some(t) => { - (format!(" in `{}`", t), format!("within `{}`, ", t)) - } - None => (String::new(), String::new()), - }; + let (post_message, pre_message) = + self.get_parent_trait_ref(&obligation.cause.code) + .map(|t| (format!(" in `{}`", t), format!("within `{}`, ", t))) + .unwrap_or((String::new(), String::new())); let mut err = struct_span_err!( self.tcx.sess, span, |
