Resolve clippy::needless_return

error: unneeded `return` statement
       --> src/helpers.rs:734:13
        |
    734 |             return Ok(());
        |             ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
        |
        = 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/range_map.rs:113:9
        |
    113 |         return true;
        |         ^^^^^^^^^^^^ help: remove `return`: `true`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/shims/posix/fs.rs:648:25
        |
    648 |                 None => return this.handle_not_found(),
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `this.handle_not_found()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
      --> src/shims/panic.rs:62:9
       |
    62 |         return Ok(());
       |         ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/shims/panic.rs:115:9
        |
    115 |         return Ok(());
        |         ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/thread.rs:477:9
        |
    477 |         return free_tls_statics;
        |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `free_tls_statics`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/thread.rs:459:17
        |
    459 |                 return false;
        |                 ^^^^^^^^^^^^^ help: remove `return`: `false`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
This commit is contained in:
David Tolnay 2022-04-29 15:48:24 -07:00
parent 6e2297fde0
commit 519755a823
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
6 changed files with 7 additions and 8 deletions

View File

@ -731,7 +731,7 @@ fn handle_unsupported<S: AsRef<str>>(&mut self, error_msg: S) -> InterpResult<'t
// message is slightly different here to make automated analysis easier
let error_msg = format!("unsupported Miri functionality: {}", error_msg.as_ref());
this.start_panic(error_msg.as_ref(), StackPopUnwind::Skip)?;
return Ok(());
Ok(())
} else {
throw_unsup_format!("{}", error_msg.as_ref());
}

View File

@ -19,7 +19,6 @@
clippy::if_same_then_else,
clippy::manual_map,
clippy::needless_lifetimes,
clippy::needless_return,
clippy::new_without_default,
clippy::op_ref,
clippy::redundant_closure,

View File

@ -110,7 +110,7 @@ fn split_index(&mut self, index: usize, split_offset: u64) -> bool
// Copy the data, and insert second element.
let second = Elem { range: second_range, data: elem.data.clone() };
self.v.insert(index + 1, second);
return true;
true
}
/// Provides mutable iteration over everything in the given range. As a side-effect,

View File

@ -59,7 +59,7 @@ fn handle_miri_start_panic(
// Jump to the unwind block to begin unwinding.
this.unwind_to_block(unwind)?;
return Ok(());
Ok(())
}
/// Handles the `try` intrinsic, the underlying implementation of `std::panicking::try`.
@ -112,7 +112,7 @@ fn handle_try(
Some(CatchUnwindData { catch_fn, data, dest: *dest, ret });
}
return Ok(());
Ok(())
}
fn handle_stack_pop(

View File

@ -645,7 +645,7 @@ fn fcntl(&mut self, args: &[OpTy<'tcx, Tag>]) -> InterpResult<'tcx, i32> {
}
}
}
None => return this.handle_not_found(),
None => this.handle_not_found(),
}
} else if this.tcx.sess.target.os == "macos" && cmd == this.eval_libc_i32("F_FULLFSYNC")? {
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {

View File

@ -456,7 +456,7 @@ fn thread_terminated(
// Delete this static from the map and from memory.
// We cannot free directly here as we cannot use `?` in this context.
free_tls_statics.push(alloc_id);
return false;
false
});
}
// Set the thread into a terminated state in the data-race detector
@ -474,7 +474,7 @@ fn thread_terminated(
thread.state = ThreadState::Enabled;
}
}
return free_tls_statics;
free_tls_statics
}
/// Decide which action to take next and on which thread.