@@ -440,28 +440,41 @@ comment so it is not attached to any definition.",
440440 type_,
441441 names,
442442 } => {
443- let mut text = String :: new ( ) ;
444- text . push_str (
445- "\
443+ let ( title , text) = match kind {
444+ TodoKind :: Keyword => {
445+ let text = "\
446446 This code will crash if it is run. Be sure to finish it before
447- running your program." ,
448- ) ;
449- let title = match kind {
450- TodoKind :: Keyword => "Todo found" ,
447+ running your program." ;
448+
449+ ( "Todo found" , text)
450+ }
451+
451452 TodoKind :: EmptyBlock => {
452- text. push_str (
453- "
454- A block must always contain at least one expression." ,
455- ) ;
456- "Incomplete block"
453+ let text = "\
454+ A block must always contain at least one expression.
455+
456+ A todo expression has been use in place of the missing code,
457+ so this code will crash if it is run. Be sure to finish it before
458+ running your program." ;
459+ ( "Incomplete block" , text)
460+ }
461+ TodoKind :: EmptyFunction { .. } => {
462+ let text = "\
463+ A function must always have an implementation.
464+
465+ A todo expression has been use in place of the missing body,
466+ so this code will crash if it is run. Be sure to finish it before
467+ running your program." ;
468+ ( "Unimplemented function" , text)
457469 }
458- TodoKind :: EmptyFunction { .. } => "Unimplemented function" ,
459470 TodoKind :: IncompleteUse => {
460- text. push_str (
461- "
462- A use expression must always be followed by at least one expression." ,
463- ) ;
464- "Incomplete use expression"
471+ let text = "\
472+ A use expression must always be followed by at least one expression.
473+
474+ A todo expression has been use in place of the missing code, so
475+ this code will crash if it is run. Be sure to finish it before
476+ running your program." ;
477+ ( "Incomplete use expression" , text)
465478 }
466479 }
467480 . into ( ) ;
@@ -476,8 +489,8 @@ A use expression must always be followed by at least one expression.",
476489 } ;
477490
478491 Diagnostic {
479- title,
480- text,
492+ title : title . into ( ) ,
493+ text : text . into ( ) ,
481494 level : diagnostic:: Level :: Warning ,
482495 location : Some ( Location {
483496 path : path. to_path_buf ( ) ,
0 commit comments