]> OzVa Git service - gn-editor/commitdiff
Clippy cleanup
authorNil Gradisnik <nil@layer.com>
Sun, 3 Dec 2017 06:38:08 +0000 (22:38 -0800)
committerNil Gradisnik <nil@layer.com>
Sun, 3 Dec 2017 06:38:08 +0000 (22:38 -0800)
Cargo.lock
Cargo.toml
src/main.rs
src/markdown.rs

index 58537011102b41d5c39a95bcc29f0dfc67ef82f9..72c34e2c4da9e13367cbb6dc8671cc463aea485a 100644 (file)
@@ -98,17 +98,17 @@ dependencies = [
 
 [[package]]
 name = "clippy"
-version = "0.0.174"
+version = "0.0.175"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "clippy_lints 0.0.174 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clippy_lints 0.0.175 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "clippy_lints"
-version = "0.0.174"
+version = "0.0.175"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -385,7 +385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "markdown-rs"
 version = "0.1.0"
 dependencies = [
- "clippy 0.0.174 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clippy 0.0.175 (registry+https://github.com/rust-lang/crates.io-index)",
  "comrak 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -719,8 +719,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c6e18fecaeac51809db57f45f4553cc0975225a7eb435a7a7e91e5e8113a84d"
 "checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b"
 "checksum clap 2.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc34bf7d5d66268b466b9852bca925ec1d2650654dab4da081e63fd230145c2e"
-"checksum clippy 0.0.174 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03ded6eba74b16dbeb598be58e874bc72f6cf12f7ccc577b328091e1d4392a"
-"checksum clippy_lints 0.0.174 (registry+https://github.com/rust-lang/crates.io-index)" = "9b8e508648d6d41040e0061f45fc5562b3af5c8a7d67853f15841fb531c8e984"
+"checksum clippy 0.0.175 (registry+https://github.com/rust-lang/crates.io-index)" = "2dae056aaec8acd5fc26722234cc9fa03b969a860d9aef0da6c5e5c996ce66ae"
+"checksum clippy_lints 0.0.175 (registry+https://github.com/rust-lang/crates.io-index)" = "d04f24bc10870e19880865d8f206168993bfc6df9cc7335c0692cad98378a4b6"
 "checksum comrak 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7bd4bf98681629d26adefa0e7d9d6d6d242ab2495c38e811d726d40a594de324"
 "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
 "checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3"
index 3d99d4e7c74c6aee71b4408b0cf2a504fc8972cd..70cee8e953b95fb1f7b7399873cc56d48e9d24fc 100644 (file)
@@ -18,4 +18,4 @@ default-features = false
 features = ["v3_22"]
 
 [dev-dependencies]
-clippy = "0.0.174"
+clippy = "0.0.175"
index 1ff84fa4967237456bc3104aff8c817dc0a312a2..84150d6fbb6646c4a10556a990edd31e18429ae7 100644 (file)
@@ -78,7 +78,7 @@ fn build_ui(application: &gtk::Application) {
             let _ = reader.read_to_string(&mut contents);
 
             text_view.get_buffer().unwrap().set_text(&contents);
-            markdown_view.get_buffer().unwrap().set_text(&string_to_html(contents));
+            markdown_view.get_buffer().unwrap().set_text(&string_to_html(&contents));
         }
 
         file_chooser.destroy();
@@ -87,14 +87,14 @@ fn build_ui(application: &gtk::Application) {
     text_view.connect_key_release_event(clone!(text_view, markdown_view, live_button => move |_, _| {
         if live_button.get_active() {
             let buffer = text_view.get_buffer().unwrap();
-            markdown_view.get_buffer().unwrap().set_text(&buffer_to_html(buffer));
+            markdown_view.get_buffer().unwrap().set_text(&buffer_to_html(&buffer));
         }
         Inhibit(true)
     }));
 
     render_button.connect_clicked(clone!(text_view, markdown_view => move |_| {
         let buffer = text_view.get_buffer().unwrap();
-        markdown_view.get_buffer().unwrap().set_text(&buffer_to_html(buffer));
+        markdown_view.get_buffer().unwrap().set_text(&buffer_to_html(&buffer));
     }));
 
     about_button.connect_clicked(clone!(about_dialog => move |_| {
index 2b18874ac0e766ada1a84fe89622aa388b1a4594..80d61445b7c31b5f31943328f96d87f2ce36991d 100644 (file)
@@ -5,7 +5,7 @@ use gtk::TextBuffer;
 
 use comrak::{markdown_to_html, ComrakOptions};
 
-pub fn string_to_html(text: String) -> String {
+pub fn string_to_html(text: &str) -> String {
     let options = ComrakOptions {
         hardbreaks: true,
         ext_table: true,
@@ -13,12 +13,12 @@ pub fn string_to_html(text: String) -> String {
         ..ComrakOptions::default()
     };
 
-    markdown_to_html(&text, &options)
+    markdown_to_html(text, &options)
 }
 
-pub fn buffer_to_html(buffer: TextBuffer) -> String {
+pub fn buffer_to_html(buffer: &TextBuffer) -> String {
     let (start, end) = buffer.get_bounds();
     let text = buffer.get_text(&start, &end, false);
 
-    string_to_html(text.unwrap())
+    string_to_html(&text.unwrap())
 }