Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

remove bad documentable implementation for optionals

author
Giacomo Cavalieri
committer
Louis Pilfold
date (Jun 15, 2026, 12:37 PM +0100) commit 58f11fa7 parent 00116641 change-id otronyys
+22 -19
+22 -12
compiler-core/src/format.rs
··· 483 483 docvec_arena![arena, "@target(javascript)", cache.line, document] 484 484 } 485 485 }; 486 - 487 - comments.to_doc(arena).append(arena, document.group(arena)) 486 + let document = document.group(arena); 487 + match comments { 488 + Some(comments) => comments.append(arena, document), 489 + None => document, 490 + } 488 491 } 489 492 490 493 pub(crate) fn module( ··· 1489 1492 1490 1493 let pattern = self.pattern(arena, cache, pattern); 1491 1494 1492 - let annotation = annotation.as_ref().map(|annotation| { 1493 - cache 1494 - .colon_space 1495 - .append(arena, self.type_ast(arena, cache, annotation)) 1496 - }); 1495 + let annotation = annotation 1496 + .as_ref() 1497 + .map(|annotation| { 1498 + cache 1499 + .colon_space 1500 + .append(arena, self.type_ast(arena, cache, annotation)) 1501 + }) 1502 + .unwrap_or(cache.nil); 1497 1503 1498 1504 let doc = keyword 1499 1505 .to_doc(arena) ··· 3699 3705 } else { 3700 3706 let assignments = use_.assignments.iter().map(|use_assignment| { 3701 3707 let pattern = self.pattern(arena, cache, &use_assignment.pattern); 3702 - let annotation = use_assignment.annotation.as_ref().map(|annotation| { 3703 - cache 3704 - .colon_space 3705 - .append(arena, self.type_ast(arena, cache, annotation)) 3706 - }); 3708 + let annotation = use_assignment 3709 + .annotation 3710 + .as_ref() 3711 + .map(|annotation| { 3712 + cache 3713 + .colon_space 3714 + .append(arena, self.type_ast(arena, cache, annotation)) 3715 + }) 3716 + .unwrap_or(cache.nil); 3707 3717 3708 3718 pattern.append(arena, annotation).group(arena) 3709 3719 });
-7
compiler-core/src/pretty_arena.rs
··· 173 173 } 174 174 } 175 175 176 - impl<'string, 'doc, D: Documentable<'string, 'doc>> Documentable<'string, 'doc> for Option<D> { 177 - fn to_doc(self, arena: &'doc DocumentArena<'string, 'doc>) -> Document<'string, 'doc> { 178 - self.map(|documentable| documentable.to_doc(arena)) 179 - .unwrap_or(arena.nil()) 180 - } 181 - } 182 - 183 176 impl<'string, 'doc> Document<'string, 'doc> { 184 177 /// Groups a document. When pretty printing a group, the formatter will 185 178 /// first attempt to fit the entire group on one line. If it fails, all