diff options
author | Jan Hrastnik | 2021-06-19 12:05:11 +0000 |
---|---|---|
committer | Jan Hrastnik | 2021-06-19 12:05:11 +0000 |
commit | 97323dc2f90f81afc82bd929d111abda540bebe5 (patch) | |
tree | c9070e906c2d959deb539bbd7eecd17edab94a5f /helix-core | |
parent | ecb884db98fbe6ed70743d1080ce7f78e121ba50 (diff) |
ran cargo fmt
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/lib.rs | 3 | ||||
-rw-r--r-- | helix-core/src/line_ending.rs | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 3f6bea5a..c02d41f8 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -111,6 +111,7 @@ pub use diagnostic::Diagnostic; pub use state::State; pub use line_ending::{ - auto_detect_line_ending, rope_slice_to_line_ending, LineEnding, DEFAULT_LINE_ENDING, get_line_ending + auto_detect_line_ending, get_line_ending, rope_slice_to_line_ending, LineEnding, + DEFAULT_LINE_ENDING, }; pub use transaction::{Assoc, Change, ChangeSet, Operation, Transaction}; diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs index 423f4b92..2cc5b5d8 100644 --- a/helix-core/src/line_ending.rs +++ b/helix-core/src/line_ending.rs @@ -95,12 +95,18 @@ pub fn auto_detect_line_ending(doc: &Rope) -> Option<LineEnding> { /// Returns the passed line's line ending, if any. pub fn get_line_ending(line: &RopeSlice) -> Option<LineEnding> { // Last character as str. - let g1 = line.slice(line.len_chars().saturating_sub(1)..).as_str().unwrap(); + let g1 = line + .slice(line.len_chars().saturating_sub(1)..) + .as_str() + .unwrap(); // Last two characters as str, or empty str if they're not contiguous. // It's fine to punt on the non-contiguous case, because Ropey guarantees // that CRLF is always contiguous. - let g2 = line.slice(line.len_chars().saturating_sub(2)..).as_str().unwrap_or(""); + let g2 = line + .slice(line.len_chars().saturating_sub(2)..) + .as_str() + .unwrap_or(""); // First check the two-character case for CRLF, then check the single-character case. str_to_line_ending(g2).or_else(|| str_to_line_ending(g1)) |