Correct manual conversion for `ChainHash`
[ldk-c-bindings] / c-bindings-gen / src / blocks.rs
index e6d1528c7f97084d7764e0add0651c0ff9679a00..e419fe095abb8dd6bd5d6dc3b403090b5b664b82 100644 (file)
@@ -250,7 +250,7 @@ pub fn write_vec_block<W: std::io::Write>(w: &mut W, mangled_container: &str, in
        writeln!(w, "impl Drop for {} {{", mangled_container).unwrap();
        writeln!(w, "\tfn drop(&mut self) {{").unwrap();
        writeln!(w, "\t\tif self.datalen == 0 {{ return; }}").unwrap();
-       writeln!(w, "\t\tunsafe {{ Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }};").unwrap();
+       writeln!(w, "\t\tlet _ = unsafe {{ Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }};").unwrap();
        writeln!(w, "\t}}").unwrap();
        writeln!(w, "}}").unwrap();
        if clonable {
@@ -442,7 +442,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut
                                match token_iter.next().unwrap() {
                                        TokenTree::Literal(lit) => {
                                                // Drop the first and last chars from lit as they are always "
-                                               let doc = format!("{}", lit);
+                                               let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}//!", prefix));
                                                writeln!(w, "{}//!{}", prefix, &doc[1..doc.len() - 1]).unwrap();
                                        },
                                        _ => unimplemented!(),
@@ -452,7 +452,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut
                                match token_iter.next().unwrap() {
                                        TokenTree::Literal(lit) => {
                                                // Drop the first and last chars from lit as they are always "
-                                               let doc = format!("{}", lit);
+                                               let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}///", prefix));
                                                writeln!(w, "{}///{}", prefix, &doc[1..doc.len() - 1]).unwrap();
                                        },
                                        _ => unimplemented!(),