Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Dec 5, 2023
1 parent 904fd47 commit 115a327
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions macro/src/dialect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ fn generate_dialect_module(

let doc = format!(
"`{name}` dialect.\n\n{}",
sanitize_documentation(&unindent::unindent(
dialect.str_value("description").unwrap_or(""),
))?
sanitize_documentation(dialect.str_value("description").unwrap_or(""),)?
);
let name = sanitize_snake_case_name(name)?;

Expand Down
2 changes: 1 addition & 1 deletion macro/src/dialect/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ impl<'a> Operation<'a> {
]
.join(" ")
},
description: unindent::unindent(definition.str_value("description")?),
description: sanitize_documentation(definition.str_value("description")?)?,
regions,
})
}
Expand Down
2 changes: 1 addition & 1 deletion macro/src/dialect/utility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn sanitize_name(name: &str) -> Result<Ident, Error> {

pub fn sanitize_documentation(string: &str) -> Result<String, Error> {
let arena = Arena::new();
let node = parse_document(&arena, string, &Default::default());
let node = parse_document(&arena, &unindent::unindent(string), &Default::default());

for node in node.traverse() {
let NodeEdge::Start(node) = node else {
Expand Down

0 comments on commit 115a327

Please sign in to comment.