diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-01-15 18:26:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-15 18:26:14 +0900 |
| commit | a584d874172b85d854f2e4d2a3256f7c23e3183a (patch) | |
| tree | a19e9e1e49c0735828c8ababae5bacb827ce814c /compiler/rustc_span/src/source_map | |
| parent | 1b8fd02daab85e129f0dda9c92ea11aaa14b7485 (diff) | |
| parent | a56bffb4f9d6f7791b2fa40412bd3e0549d76cc3 (diff) | |
| download | rust-a584d874172b85d854f2e4d2a3256f7c23e3183a.tar.gz rust-a584d874172b85d854f2e4d2a3256f7c23e3183a.zip | |
Rollup merge of #80944 - LingMan:map_or, r=nagisa
Use Option::map_or instead of `.map(..).unwrap_or(..)` ``@rustbot`` modify labels +C-cleanup +T-compiler
Diffstat (limited to 'compiler/rustc_span/src/source_map')
| -rw-r--r-- | compiler/rustc_span/src/source_map/tests.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/source_map/tests.rs b/compiler/rustc_span/src/source_map/tests.rs index b8459eee4ec..3f22829b049 100644 --- a/compiler/rustc_span/src/source_map/tests.rs +++ b/compiler/rustc_span/src/source_map/tests.rs @@ -107,7 +107,7 @@ fn t7() { fn span_from_selection(input: &str, selection: &str) -> Span { assert_eq!(input.len(), selection.len()); let left_index = selection.find('~').unwrap() as u32; - let right_index = selection.rfind('~').map(|x| x as u32).unwrap_or(left_index); + let right_index = selection.rfind('~').map_or(left_index, |x| x as u32); Span::with_root_ctxt(BytePos(left_index), BytePos(right_index + 1)) } |
