Resolve needless_return clippy lints

error: unneeded `return` statement
       --> src/emitter.rs:253:41
        |
    253 |         YAML_EMIT_STREAM_START_STATE => return yaml_emitter_emit_stream_start(emitter, event),
        |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_stream_start(emitter, event)`
        |
        = note: `-D clippy::needless-return` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:255:13
        |
    255 |             return yaml_emitter_emit_document_start(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_document_start(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:258:13
        |
    258 |             return yaml_emitter_emit_document_start(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_document_start(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:261:13
        |
    261 |             return yaml_emitter_emit_document_content(emitter, event)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_document_content(emitter, event)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:263:41
        |
    263 |         YAML_EMIT_DOCUMENT_END_STATE => return yaml_emitter_emit_document_end(emitter, event),
        |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_document_end(emitter, event)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:265:13
        |
    265 |             return yaml_emitter_emit_flow_sequence_item(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_sequence_item(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:268:13
        |
    268 |             return yaml_emitter_emit_flow_sequence_item(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_sequence_item(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:271:13
        |
    271 |             return yaml_emitter_emit_flow_mapping_key(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_mapping_key(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:274:13
        |
    274 |             return yaml_emitter_emit_flow_mapping_key(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_mapping_key(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:277:13
        |
    277 |             return yaml_emitter_emit_flow_mapping_value(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_mapping_value(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:280:13
        |
    280 |             return yaml_emitter_emit_flow_mapping_value(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_flow_mapping_value(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:283:13
        |
    283 |             return yaml_emitter_emit_block_sequence_item(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_sequence_item(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:286:13
        |
    286 |             return yaml_emitter_emit_block_sequence_item(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_sequence_item(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:289:13
        |
    289 |             return yaml_emitter_emit_block_mapping_key(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_mapping_key(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:292:13
        |
    292 |             return yaml_emitter_emit_block_mapping_key(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_mapping_key(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:295:13
        |
    295 |             return yaml_emitter_emit_block_mapping_value(emitter, event, true)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_mapping_value(emitter, event, true)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:298:13
        |
    298 |             return yaml_emitter_emit_block_mapping_value(emitter, event, false)
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `yaml_emitter_emit_block_mapping_value(emitter, event, false)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/emitter.rs:301:13
        |
    301 | /             return yaml_emitter_set_emitter_error(
    302 | |                 emitter,
    303 | |                 b"expected nothing after STREAM-END\0" as *const u8 as *const libc::c_char,
    304 | |             )
        | |_____________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    301 ~             yaml_emitter_set_emitter_error(
    302 +                 emitter,
    303 +                 b"expected nothing after STREAM-END\0" as *const u8 as *const libc::c_char,
    304 +             )
        |
This commit is contained in:
David Tolnay 2022-07-27 17:55:25 -07:00
parent aada00c078
commit 326db391d8
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -250,59 +250,53 @@ unsafe fn yaml_emitter_state_machine(
event: *mut yaml_event_t,
) -> Success {
match (*emitter).state {
YAML_EMIT_STREAM_START_STATE => return yaml_emitter_emit_stream_start(emitter, event),
YAML_EMIT_STREAM_START_STATE => yaml_emitter_emit_stream_start(emitter, event),
YAML_EMIT_FIRST_DOCUMENT_START_STATE => {
return yaml_emitter_emit_document_start(emitter, event, true)
yaml_emitter_emit_document_start(emitter, event, true)
}
YAML_EMIT_DOCUMENT_START_STATE => {
return yaml_emitter_emit_document_start(emitter, event, false)
}
YAML_EMIT_DOCUMENT_CONTENT_STATE => {
return yaml_emitter_emit_document_content(emitter, event)
}
YAML_EMIT_DOCUMENT_END_STATE => return yaml_emitter_emit_document_end(emitter, event),
YAML_EMIT_DOCUMENT_START_STATE => yaml_emitter_emit_document_start(emitter, event, false),
YAML_EMIT_DOCUMENT_CONTENT_STATE => yaml_emitter_emit_document_content(emitter, event),
YAML_EMIT_DOCUMENT_END_STATE => yaml_emitter_emit_document_end(emitter, event),
YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE => {
return yaml_emitter_emit_flow_sequence_item(emitter, event, true)
yaml_emitter_emit_flow_sequence_item(emitter, event, true)
}
YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE => {
return yaml_emitter_emit_flow_sequence_item(emitter, event, false)
yaml_emitter_emit_flow_sequence_item(emitter, event, false)
}
YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE => {
return yaml_emitter_emit_flow_mapping_key(emitter, event, true)
yaml_emitter_emit_flow_mapping_key(emitter, event, true)
}
YAML_EMIT_FLOW_MAPPING_KEY_STATE => {
return yaml_emitter_emit_flow_mapping_key(emitter, event, false)
yaml_emitter_emit_flow_mapping_key(emitter, event, false)
}
YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE => {
return yaml_emitter_emit_flow_mapping_value(emitter, event, true)
yaml_emitter_emit_flow_mapping_value(emitter, event, true)
}
YAML_EMIT_FLOW_MAPPING_VALUE_STATE => {
return yaml_emitter_emit_flow_mapping_value(emitter, event, false)
yaml_emitter_emit_flow_mapping_value(emitter, event, false)
}
YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE => {
return yaml_emitter_emit_block_sequence_item(emitter, event, true)
yaml_emitter_emit_block_sequence_item(emitter, event, true)
}
YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE => {
return yaml_emitter_emit_block_sequence_item(emitter, event, false)
yaml_emitter_emit_block_sequence_item(emitter, event, false)
}
YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE => {
return yaml_emitter_emit_block_mapping_key(emitter, event, true)
yaml_emitter_emit_block_mapping_key(emitter, event, true)
}
YAML_EMIT_BLOCK_MAPPING_KEY_STATE => {
return yaml_emitter_emit_block_mapping_key(emitter, event, false)
yaml_emitter_emit_block_mapping_key(emitter, event, false)
}
YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE => {
return yaml_emitter_emit_block_mapping_value(emitter, event, true)
yaml_emitter_emit_block_mapping_value(emitter, event, true)
}
YAML_EMIT_BLOCK_MAPPING_VALUE_STATE => {
return yaml_emitter_emit_block_mapping_value(emitter, event, false)
yaml_emitter_emit_block_mapping_value(emitter, event, false)
}
YAML_EMIT_END_STATE => {
return yaml_emitter_set_emitter_error(
YAML_EMIT_END_STATE => yaml_emitter_set_emitter_error(
emitter,
b"expected nothing after STREAM-END\0" as *const u8 as *const libc::c_char,
)
}
),
}
}