3 clippy fixes

This commit is contained in:
David Faure 2025-12-09 13:33:23 +01:00 committed by Olivier Goffart
parent eb80f8a1a5
commit 45dfe28aa9
3 changed files with 7 additions and 9 deletions

View file

@ -9,10 +9,9 @@ fn main() -> Result<(), anyhow::Error> {
let manifest_dir = std::env::var_os("CARGO_MANIFEST_DIR").unwrap();
// Go from $root/api/cpp down to $root
let root_dir = Path::new(&manifest_dir).ancestors().nth(2).expect(&format!(
"Failed to locate root directory, relative to {}",
manifest_dir.to_string_lossy()
));
let root_dir = Path::new(&manifest_dir).ancestors().nth(2).unwrap_or_else(|| {
panic!("Failed to locate root directory, relative to {}", manifest_dir.to_string_lossy())
});
println!("cargo:rerun-if-env-changed=SLINT_GENERATED_INCLUDE_DIR");
let output_dir = std::env::var_os("SLINT_GENERATED_INCLUDE_DIR").unwrap_or_else(|| {

View file

@ -247,11 +247,11 @@ pub extern "C" fn slint_open_url(url: &SharedString) {
#[unsafe(no_mangle)]
pub extern "C" fn slint_escape_markdown(text: &mut SharedString) -> &SharedString {
*text = i_slint_core::escape_markdown(&text).into();
*text = i_slint_core::escape_markdown(text).into();
text
}
#[unsafe(no_mangle)]
pub extern "C" fn slint_parse_markdown(text: &SharedString, out: &mut StyledText) {
*out = i_slint_core::parse_markdown(&text);
*out = i_slint_core::parse_markdown(text);
}

View file

@ -12,8 +12,8 @@ use std::rc::Rc;
pub fn lower_timers(component: &Rc<Component>, diag: &mut BuildDiagnostics) {
visit_all_expressions(component, |e, _| {
e.visit_recursive_mut(&mut |e| match e {
Expression::FunctionCall { function, arguments, .. } => {
e.visit_recursive_mut(&mut |e| {
if let Expression::FunctionCall { function, arguments, .. } = e {
if let Callable::Builtin(BuiltinFunction::StartTimer | BuiltinFunction::StopTimer) =
function
&& let [Expression::ElementReference(timer)] = arguments.as_slice()
@ -32,7 +32,6 @@ pub fn lower_timers(component: &Rc<Component>, diag: &mut BuildDiagnostics) {
}
}
}
_ => {}
});
});