Skip to content

Commit eca0a47

Browse files
committed
apply clippy lint for_loops_over_fallibles
apply clippy lint doc_lazy_continuation apply clippy lint needless_borrows_for_generic_args ignore clippy lint macro_metavars_in_unsafe fixed clippy lint unexpected_cfgs by removing code that would support a no_std build remove unused feature options from vm
1 parent 79c07fe commit eca0a47

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

bridge_macros/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn get_generic_argument_from_type_path(
186186
type_path: &TypePath,
187187
) -> Option<(&GenericArgument, &TypePath)> {
188188
if type_path.path.segments.len() == 1 {
189-
for path_segment in &type_path.path.segments.iter().next_back() {
189+
if let Some(path_segment) = &type_path.path.segments.iter().next_back() {
190190
if let PathArguments::AngleBracketed(args) = &path_segment.arguments {
191191
if let Some(ty) = args.args.iter().next_back() {
192192
return Some((ty, type_path));
@@ -1552,10 +1552,10 @@ fn parse_attributes(
15521552
/// intern_<original_fn_name>
15531553
/// parse_<original_fn_name>
15541554
/// - intern_ is the simplest function, it is generated to be called within sl-sh to avoid writing
1555-
/// boilerplate code to submit a function symbol and the associated code to the runtime.
1555+
/// boilerplate code to submit a function symbol and the associated code to the runtime.
15561556
/// - parse_ has the same function signature as all rust native functions, it takes the environment
1557-
/// and a list of args. It evals those arguments at runtime and converts them to rust types
1558-
/// they can be consumed by the target rust function.
1557+
/// and a list of args. It evals those arguments at runtime and converts them to rust types
1558+
/// they can be consumed by the target rust function.
15591559
fn generate_sl_sh_fn(
15601560
original_item_fn: &ItemFn,
15611561
attr_args: AttributeArgs,

slosh_lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ fn run_shell_tty() -> i32 {
490490
//Box::new(keymap::Emacs::new())
491491
con.set_keymap(Box::new(vi));
492492

493-
if let Err(e) = con.history.set_file_name_and_load_history(&history_file()) {
493+
if let Err(e) = con.history.set_file_name_and_load_history(history_file()) {
494494
println!("Error loading history: {e}");
495495
}
496496
shell::run::setup_shell_tty(STDIN_FILENO);

vm/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ version = "0.1.0"
44
authors = ["Steven Stanfield <[email protected]>"]
55
edition = "2021"
66

7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8-
9-
[features]
10-
gc = []
11-
nohelmet = []
12-
137
[dependencies]
148
unicode-segmentation = "1.10.1"
159
bridge_types = { workspace = true }

vm/src/fxhasher.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
//! # fn main() { }
2424
//! ```
2525
26-
#[cfg(feature = "std")]
27-
extern crate std;
2826

2927
use core::convert::TryInto;
3028
use core::default::Default;

vm/src/vm/macros.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#[macro_export]
22
macro_rules! inc_ip {
33
($code_ip:expr) => {{
4+
#[allow(clippy::macro_metavars_in_unsafe)]
45
unsafe {
6+
// SAFETY: `$code_ip` must be a valid pointer to at least 1 byte of memory.
57
let r = *$code_ip;
68
$code_ip = $code_ip.offset(1);
79
r
@@ -33,7 +35,9 @@ macro_rules! decode_u8 {
3335
#[macro_export]
3436
macro_rules! decode_u16 {
3537
($code:expr) => {{
38+
#[allow(clippy::macro_metavars_in_unsafe)]
3639
unsafe {
40+
// SAFETY: `$code` must be a valid pointer to at least 2 bytes of memory.
3741
let idx1 = *$code;
3842
let idx2 = *$code.offset(1);
3943
$code = $code.offset(2);
@@ -45,7 +49,9 @@ macro_rules! decode_u16 {
4549
#[macro_export]
4650
macro_rules! decode_u32 {
4751
($code:expr) => {{
52+
#[allow(clippy::macro_metavars_in_unsafe)]
4853
unsafe {
54+
// SAFETY: `$code` must be a valid pointer to at least 4 bytes of memory.
4955
let idx1 = *$code;
5056
let idx2 = *$code.offset(1);
5157
let idx3 = *$code.offset(2);
@@ -74,7 +80,9 @@ macro_rules! decode2 {
7480
(decode_u16!($code), decode_u16!($code))
7581
} else {
7682
//(crate::inc_ip!($code) as u16, crate::inc_ip!($code) as u16)
83+
#[allow(clippy::macro_metavars_in_unsafe)]
7784
unsafe {
85+
// SAFETY: $code must be a valid pointer to at least 2 bytes of memory.
7886
let r = (*$code as u16, *$code.offset(1) as u16);
7987
$code = $code.offset(2);
8088
r
@@ -89,7 +97,9 @@ macro_rules! decode3 {
8997
if $wide {
9098
(decode_u16!($code), decode_u16!($code), decode_u16!($code))
9199
} else {
100+
#[allow(clippy::macro_metavars_in_unsafe)]
92101
unsafe {
102+
// SAFETY: $code must be a valid pointer to at least 3 bytes of memory.
93103
let r = (
94104
*$code as u16,
95105
*$code.offset(1) as u16,

0 commit comments

Comments
 (0)