chiark / gitweb /
Introduce a type alias
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Feb 2024 12:41:45 +0000 (12:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Feb 2024 14:26:16 +0000 (14:26 +0000)
This type is repeated.  clippy complains about it too.

src/editor.rs

index 6670d9b5096c256cd102eb184f1d559797c56982..c92a99e1fde31fd24a2d7b599a47e51f345122f4 100644 (file)
@@ -691,15 +691,18 @@ fn test_single_line_visibility() {
     );
 }
 
+type BottomLineEditorOverlayResult =
+    Box<dyn Fn(&str, &mut Client) -> LogicalAction>;
+
 struct BottomLineEditorOverlay {
     ed: SingleLineEditor,
-    result: Box<dyn Fn(&str, &mut Client) -> LogicalAction>,
+    result: BottomLineEditorOverlayResult,
 }
 
 impl BottomLineEditorOverlay {
     fn new(
         prompt: ColouredString,
-        result: Box<dyn Fn(&str, &mut Client) -> LogicalAction>,
+        result: BottomLineEditorOverlayResult,
     ) -> Self {
         BottomLineEditorOverlay {
             ed: SingleLineEditor::new_with_prompt("".to_owned(), prompt),