about summary refs log tree commit diff
path: root/compiler/rustc_span/src/lib.rs
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-10-27 15:47:29 -0700
committerTyson Nottingham <tgnottingham@gmail.com>2020-10-27 15:47:29 -0700
commit47dad31a04724b969d260c32f136bda47fcba63f (patch)
treee9bad83ce31586656c45896647265eed9b26fe2e /compiler/rustc_span/src/lib.rs
parentdf59a44feadad386a8b69cfafaf50605c6af2689 (diff)
downloadrust-47dad31a04724b969d260c32f136bda47fcba63f.tar.gz
rust-47dad31a04724b969d260c32f136bda47fcba63f.zip
rustc_span: represent line bounds with Range
Diffstat (limited to 'compiler/rustc_span/src/lib.rs')
-rw-r--r--compiler/rustc_span/src/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 21a38283f45..54b0040dc09 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -52,7 +52,7 @@ use std::cell::RefCell;
 use std::cmp::{self, Ordering};
 use std::fmt;
 use std::hash::Hash;
-use std::ops::{Add, Sub};
+use std::ops::{Add, Range, Sub};
 use std::path::{Path, PathBuf};
 use std::str::FromStr;
 
@@ -1426,16 +1426,16 @@ impl SourceFile {
         if line_index >= 0 { Some(line_index as usize) } else { None }
     }
 
-    pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) {
+    pub fn line_bounds(&self, line_index: usize) -> Range<BytePos> {
         if self.is_empty() {
-            return (self.start_pos, self.end_pos);
+            return self.start_pos..self.end_pos;
         }
 
         assert!(line_index < self.lines.len());
         if line_index == (self.lines.len() - 1) {
-            (self.lines[line_index], self.end_pos)
+            self.lines[line_index]..self.end_pos
         } else {
-            (self.lines[line_index], self.lines[line_index + 1])
+            self.lines[line_index]..self.lines[line_index + 1]
         }
     }