From b0979e95bdc805cbe6c9e01ec05ed85d9d702167 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sun, 23 Feb 2020 20:38:42 +0100 Subject: clang-parser: allow nameless entities as it is common in C for example: typedef struct { ... } my_struct; The struct is nameless, the typedef isn't. For now this pattern is not detected, and renders badly in the generated documentation. It stopped spouting errors for big C codebases, though. --- src/parser/clang/entities.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/parser/clang/entities.rs') diff --git a/src/parser/clang/entities.rs b/src/parser/clang/entities.rs index f0acea6..e6ec296 100644 --- a/src/parser/clang/entities.rs +++ b/src/parser/clang/entities.rs @@ -63,8 +63,7 @@ impl<'a> TryFrom> for Description { fn try_from(entity: clang::Entity) -> Result { let name = entity .get_display_name() - // TODO: Properly define an error - .ok_or_else(|| anyhow!("Entity has no name"))?; + .unwrap_or_default(); // TODO: is that the best? if let (Some(brief), Some(comment)) = (entity.get_comment_brief(), entity.get_comment()) { -- cgit v1.2.3