@@ -71,11 +71,7 @@ pub fn print_unicode(graph: &GitGraph, settings: &Settings) -> Result<UnicodeGra
7171 } ;
7272
7373 // 2. Prepare wrapping for commit text (using references to the new indent strings)
74- let wrap_options = if let Some ( ( width, _, _) ) = settings. wrapping {
75- create_wrapping_options ( width, & indent1, & indent2, num_cols + 4 ) ?
76- } else {
77- None
78- } ;
74+ let wrap_options = get_wrapping_options ( settings, num_cols, & indent1, & indent2) ?;
7975
8076 // 3. Compute commit text and index map
8177 let ( mut text_lines, index_map) =
@@ -109,6 +105,22 @@ fn calculate_graph_dimensions(graph: &GitGraph) -> usize {
109105 + 1
110106}
111107
108+ /// Prepares wrapping options, returning the options structure.
109+ // 'a now refers to the lifetime of the indent strings passed in.
110+ fn get_wrapping_options < ' a > (
111+ settings : & Settings ,
112+ num_cols : usize ,
113+ indent1 : & ' a str , // Takes reference to owned string
114+ indent2 : & ' a str , // Takes reference to owned string
115+ ) -> Result < Option < Options < ' a > > , String > {
116+ if let Some ( ( width, _, _) ) = settings. wrapping {
117+ // We now pass the references directly to create_wrapping_options
118+ create_wrapping_options ( width, indent1, indent2, num_cols + 4 )
119+ } else {
120+ Ok ( None )
121+ }
122+ }
123+
112124/// Iterates through commits to compute text lines, blank line inserts, and the index map.
113125fn build_commit_lines_and_map < ' a > (
114126 graph : & GitGraph ,
0 commit comments