diff options
| author | Austin Bonander <austin.bonander@gmail.com> | 2017-01-16 17:59:11 -0800 |
|---|---|---|
| committer | Austin Bonander <austin.bonander@gmail.com> | 2017-01-16 22:41:22 -0800 |
| commit | 68439614bad206570f0958fc672a3e11cccebf53 (patch) | |
| tree | 3e3f14605b06f15764d336f08a0f370b8e9a7c38 | |
| parent | 375cbd20cfcc9dbf15682bcfc0081ce5ce95567b (diff) | |
| download | rust-68439614bad206570f0958fc672a3e11cccebf53.tar.gz rust-68439614bad206570f0958fc672a3e11cccebf53.zip | |
Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2478ed169cd..66c66ad8940 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -896,9 +896,10 @@ fn find_lang_feature_issue(feature: &str) -> Option<u32> { issue } else { // search in Accepted or Removed features - ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES.iter()) - .find(|t| t.0 == feature) - .unwrap().2 + match ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).find(|t| t.0 == feature) { + Some(&(_, _, issue)) => issue, + None => panic!("Feature `{}` is not declared anywhere", feature), + } } } |
