Merge pull request #688 from Mathieu-Lala/fix/lint

Fix lints warnings and enhance the CI
This commit is contained in:
Stephen Chung
2023-02-10 18:32:14 +08:00
committed by GitHub
41 changed files with 204 additions and 194 deletions

View File

@@ -140,15 +140,15 @@ mod print_debug_functions {
}
/// Return the empty string.
#[allow(unused_variables)]
#[rhai_fn(name = "print", name = "to_string")]
pub fn print_unit(ctx: NativeCallContext, unit: ()) -> ImmutableString {
let _ = unit;
ctx.engine().const_empty_string()
}
/// Convert the unit into a string in debug format.
#[allow(unused_variables)]
#[rhai_fn(name = "debug", name = "to_debug")]
pub fn debug_unit(unit: ()) -> ImmutableString {
let _ = unit;
"()".into()
}

View File

@@ -83,13 +83,14 @@ mod string_functions {
buf.into()
}
#[allow(unused_variables)]
#[rhai_fn(name = "+")]
pub fn add_append_unit(string: ImmutableString, item: ()) -> ImmutableString {
let _ = item;
string
}
#[allow(unused_variables)]
#[rhai_fn(name = "+")]
pub fn add_prepend_unit(_item: (), string: ImmutableString) -> ImmutableString {
pub fn add_prepend_unit(item: (), string: ImmutableString) -> ImmutableString {
string
}
@@ -101,11 +102,9 @@ mod string_functions {
pub fn add_assign_append_char(string: &mut ImmutableString, character: char) {
*string += character;
}
#[allow(unused_variables)]
#[rhai_fn(name = "+=")]
pub fn add_assign_append_unit(string: &mut ImmutableString, item: ()) {
let _ = string;
let _ = item;
}
pub fn add_assign_append_unit(string: &mut ImmutableString, item: ()) {}
#[cfg(not(feature = "no_index"))]
pub mod blob_functions {

View File

@@ -155,7 +155,9 @@ mod time_functions {
})
}
} else {
Ok(timestamp - Duration::from_millis((seconds * 1000.0) as u64))
Ok(timestamp
.checked_sub(Duration::from_millis((seconds * 1000.0) as u64))
.unwrap())
}
}
@@ -212,7 +214,9 @@ mod time_functions {
))
})
} else {
Ok(timestamp - Duration::from_secs(seconds as u64))
Ok(timestamp
.checked_sub(Duration::from_secs(seconds as u64))
.unwrap())
}
}