diff --git a/src/api.rs b/src/api.rs index 62ae6cb..489e678 100644 --- a/src/api.rs +++ b/src/api.rs @@ -199,6 +199,7 @@ pub(crate) unsafe fn yaml_queue_extend( /// for destroying the object using the yaml_parser_delete() function. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> libc::c_int { __assert!(!parser.is_null()); memset( @@ -567,6 +568,7 @@ pub unsafe fn yaml_parser_set_encoding(mut parser: *mut yaml_parser_t, encoding: /// for destroying the object using the yaml_emitter_delete() function. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> libc::c_int { __assert!(!emitter.is_null()); memset( @@ -1000,6 +1002,7 @@ unsafe fn yaml_check_utf8(start: *const yaml_char_t, length: size_t) -> libc::c_ /// Create the STREAM-START event. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_stream_start_event_initialize( mut event: *mut yaml_event_t, encoding: yaml_encoding_t, @@ -1025,6 +1028,7 @@ pub unsafe fn yaml_stream_start_event_initialize( /// Create the STREAM-END event. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_stream_end_event_initialize(mut event: *mut yaml_event_t) -> libc::c_int { let mark = yaml_mark_t { index: 0_u64, @@ -1049,6 +1053,7 @@ pub unsafe fn yaml_stream_end_event_initialize(mut event: *mut yaml_event_t) -> /// ignored by the emitter. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_document_start_event_initialize( mut event: *mut yaml_event_t, version_directive: *mut yaml_version_directive_t, @@ -1220,6 +1225,7 @@ pub unsafe fn yaml_document_start_event_initialize( /// ignored by the emitter. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_document_end_event_initialize( mut event: *mut yaml_event_t, implicit: libc::c_int, @@ -1245,6 +1251,7 @@ pub unsafe fn yaml_document_end_event_initialize( /// Create an ALIAS event. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_alias_event_initialize( mut event: *mut yaml_event_t, anchor: *const yaml_char_t, @@ -1284,6 +1291,7 @@ pub unsafe fn yaml_alias_event_initialize( /// `quoted_implicit` flags must be set. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_scalar_event_initialize( mut event: *mut yaml_event_t, anchor: *const yaml_char_t, @@ -1390,6 +1398,7 @@ pub unsafe fn yaml_scalar_event_initialize( /// Either the `tag` attribute or the `implicit` flag must be set. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_sequence_start_event_initialize( mut event: *mut yaml_event_t, anchor: *const yaml_char_t, @@ -1467,6 +1476,7 @@ pub unsafe fn yaml_sequence_start_event_initialize( /// Create a SEQUENCE-END event. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_sequence_end_event_initialize(mut event: *mut yaml_event_t) -> libc::c_int { let mark = yaml_mark_t { index: 0_u64, @@ -1492,6 +1502,7 @@ pub unsafe fn yaml_sequence_end_event_initialize(mut event: *mut yaml_event_t) - /// Either the `tag` attribute or the `implicit` flag must be set. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_mapping_start_event_initialize( mut event: *mut yaml_event_t, anchor: *const yaml_char_t, @@ -1569,6 +1580,7 @@ pub unsafe fn yaml_mapping_start_event_initialize( /// Create a MAPPING-END event. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_mapping_end_event_initialize(mut event: *mut yaml_event_t) -> libc::c_int { let mark = yaml_mark_t { index: 0_u64, @@ -1630,6 +1642,7 @@ pub unsafe fn yaml_event_delete(event: *mut yaml_event_t) { /// Create a YAML document. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_document_initialize( mut document: *mut yaml_document_t, version_directive: *mut yaml_version_directive_t, @@ -1930,6 +1943,7 @@ pub unsafe fn yaml_document_get_root_node(document: *mut yaml_document_t) -> *mu /// The `style` argument may be ignored by the emitter. /// /// Returns the node id or 0 on error. +#[must_use] pub unsafe fn yaml_document_add_scalar( document: *mut yaml_document_t, mut tag: *const yaml_char_t, @@ -2015,6 +2029,7 @@ pub unsafe fn yaml_document_add_scalar( /// The `style` argument may be ignored by the emitter. /// /// Returns the node id or 0 on error. +#[must_use] pub unsafe fn yaml_document_add_sequence( document: *mut yaml_document_t, mut tag: *const yaml_char_t, @@ -2109,6 +2124,7 @@ pub unsafe fn yaml_document_add_sequence( /// The `style` argument may be ignored by the emitter. /// /// Returns the node id or 0 on error. +#[must_use] pub unsafe fn yaml_document_add_mapping( document: *mut yaml_document_t, mut tag: *const yaml_char_t, @@ -2201,6 +2217,7 @@ pub unsafe fn yaml_document_add_mapping( /// Add an item to a SEQUENCE node. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_document_append_sequence_item( document: *mut yaml_document_t, sequence: libc::c_int, @@ -2282,6 +2299,7 @@ pub unsafe fn yaml_document_append_sequence_item( /// Add a pair of a key and a value to a MAPPING node. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_document_append_mapping_pair( document: *mut yaml_document_t, mapping: libc::c_int, diff --git a/src/dumper.rs b/src/dumper.rs index 9eabe8b..41147e1 100644 --- a/src/dumper.rs +++ b/src/dumper.rs @@ -17,6 +17,7 @@ use core::ptr::{self, addr_of_mut}; /// This function should be used before yaml_emitter_dump() is called. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> libc::c_int { let mut event = MaybeUninit::::uninit(); let event = event.as_mut_ptr(); @@ -48,6 +49,7 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> libc::c_int /// This function should be used after yaml_emitter_dump() is called. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_int { let mut event = MaybeUninit::::uninit(); let event = event.as_mut_ptr(); @@ -84,6 +86,7 @@ pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_in /// emitted. The document object is destroyed even if the function fails. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_dump( emitter: *mut yaml_emitter_t, document: *mut yaml_document_t, diff --git a/src/emitter.rs b/src/emitter.rs index fda5635..7d6d827 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -39,6 +39,7 @@ unsafe fn yaml_emitter_set_emitter_error( /// function fails. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_emit( mut emitter: *mut yaml_emitter_t, event: *mut yaml_event_t, diff --git a/src/loader.rs b/src/loader.rs index 5932ddb..ef2bf4b 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -34,6 +34,7 @@ struct loader_ctx { /// the parser. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_parser_load( mut parser: *mut yaml_parser_t, document: *mut yaml_document_t, diff --git a/src/parser.rs b/src/parser.rs index ea9ace3..5eb0c9b 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -45,6 +45,7 @@ use core::ptr::{self, addr_of_mut}; /// parser. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_parser_parse( parser: *mut yaml_parser_t, event: *mut yaml_event_t, diff --git a/src/scanner.rs b/src/scanner.rs index a7cfe83..fd5ea83 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -34,6 +34,7 @@ use core::ptr::{self, addr_of_mut}; /// the parser. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_parser_scan( mut parser: *mut yaml_parser_t, token: *mut yaml_token_t, diff --git a/src/writer.rs b/src/writer.rs index 2a8d883..8de8bf9 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -17,6 +17,7 @@ unsafe fn yaml_emitter_set_writer_error( /// Flush the accumulated characters to the output. /// /// Returns 1 if the function succeeded, 0 on error. +#[must_use] pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int { __assert!(!emitter.is_null()); __assert!(((*emitter).write_handler).is_some());