mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-12-04 05:21:06 +00:00
Resolve clippy map_unwrap_or lint in demo
This commit is contained in:
parent
515cef8044
commit
831b02fc6b
@ -320,7 +320,7 @@ pub struct MultiBuf {
|
|||||||
pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
||||||
let next = buf.chunks.get(buf.pos);
|
let next = buf.chunks.get(buf.pos);
|
||||||
buf.pos += 1;
|
buf.pos += 1;
|
||||||
next.map(Vec::as_slice).unwrap_or(&[])
|
next.map_or(&[], Vec::as_slice)
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# fn main() {
|
# fn main() {
|
||||||
@ -411,7 +411,7 @@ This is now ready to use. :)
|
|||||||
# pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
# pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
||||||
# let next = buf.chunks.get(buf.pos);
|
# let next = buf.chunks.get(buf.pos);
|
||||||
# buf.pos += 1;
|
# buf.pos += 1;
|
||||||
# next.map(Vec::as_slice).unwrap_or(&[])
|
# next.map_or(&[], Vec::as_slice)
|
||||||
# }
|
# }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -537,7 +537,7 @@ mod ffi {
|
|||||||
# pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
# pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
||||||
# let next = buf.chunks.get(buf.pos);
|
# let next = buf.chunks.get(buf.pos);
|
||||||
# buf.pos += 1;
|
# buf.pos += 1;
|
||||||
# next.map(Vec::as_slice).unwrap_or(&[])
|
# next.map_or(&[], Vec::as_slice)
|
||||||
# }
|
# }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -38,7 +38,7 @@ pub struct MultiBuf {
|
|||||||
pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
pub fn next_chunk(buf: &mut MultiBuf) -> &[u8] {
|
||||||
let next = buf.chunks.get(buf.pos);
|
let next = buf.chunks.get(buf.pos);
|
||||||
buf.pos += 1;
|
buf.pos += 1;
|
||||||
next.map(Vec::as_slice).unwrap_or(&[])
|
next.map_or(&[], Vec::as_slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user