From f195f25eeddb604651d72e3198db0ce78af29f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Sun, 11 Sep 2022 19:21:59 +0200 Subject: [PATCH] Remove load_rope --- lapce-proxy/src/buffer.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lapce-proxy/src/buffer.rs b/lapce-proxy/src/buffer.rs index b208ae5a..4ff95a4d 100644 --- a/lapce-proxy/src/buffer.rs +++ b/lapce-proxy/src/buffer.rs @@ -23,11 +23,7 @@ pub struct Buffer { impl Buffer { pub fn new(id: BufferId, path: PathBuf) -> Buffer { - let rope = if let Ok(rope) = load_rope(&path) { - rope - } else { - Rope::from("") - }; + let rope = Rope::from(load_file(&path).unwrap_or_default()); let rev = if rope.is_empty() { 0 } else { 1 }; let language_id = language_id_from_path(&path).unwrap_or(""); let mod_time = get_mod_time(&path); @@ -149,10 +145,6 @@ pub fn load_file(path: &Path) -> Result { Ok(read_path_to_string_lossy(path)?) } -fn load_rope(path: &Path) -> Result { - Ok(Rope::from(read_path_to_string_lossy(path)?)) -} - pub fn read_path_to_string_lossy>( path: P, ) -> Result {