mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Janitor: Fix clippy::map_clone
This commit is contained in:
parent
0d73917526
commit
04738a900f
3 changed files with 4 additions and 4 deletions
|
@ -483,7 +483,7 @@ declare_types! {
|
||||||
|
|
||||||
method show(mut cx) {
|
method show(mut cx) {
|
||||||
let this = cx.this();
|
let this = cx.this();
|
||||||
let window = cx.borrow(&this, |x| x.0.as_ref().map(|c| c.clone()));
|
let window = cx.borrow(&this, |x| x.0.as_ref().cloned());
|
||||||
let window = window.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
let window = window.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
||||||
window.show();
|
window.show();
|
||||||
Ok(JsUndefined::new().as_value(&mut cx))
|
Ok(JsUndefined::new().as_value(&mut cx))
|
||||||
|
@ -491,7 +491,7 @@ declare_types! {
|
||||||
|
|
||||||
method hide(mut cx) {
|
method hide(mut cx) {
|
||||||
let this = cx.this();
|
let this = cx.this();
|
||||||
let window = cx.borrow(&this, |x| x.0.as_ref().map(|c| c.clone()));
|
let window = cx.borrow(&this, |x| x.0.as_ref().cloned());
|
||||||
let window = window.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
let window = window.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
||||||
window.hide();
|
window.hide();
|
||||||
Ok(JsUndefined::new().as_value(&mut cx))
|
Ok(JsUndefined::new().as_value(&mut cx))
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ unsafe extern "C" fn parent_item(component: ComponentRefPin, index: usize, resul
|
||||||
.original
|
.original
|
||||||
.parent_element
|
.parent_element
|
||||||
.upgrade()
|
.upgrade()
|
||||||
.and_then(|e| e.borrow().item_index.get().map(|x| *x));
|
.and_then(|e| e.borrow().item_index.get().cloned());
|
||||||
if let (Some(parent_offset), Some(parent_index)) =
|
if let (Some(parent_offset), Some(parent_index)) =
|
||||||
(instance_ref.component_type.parent_component_offset, parent_item_index)
|
(instance_ref.component_type.parent_component_offset, parent_item_index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,7 +188,7 @@ pub fn set_contents(path: &Path, content: String) {
|
||||||
/// In any was, register it as a dependency
|
/// In any was, register it as a dependency
|
||||||
fn get_file_from_cache(path: PathBuf) -> Option<String> {
|
fn get_file_from_cache(path: PathBuf) -> Option<String> {
|
||||||
let mut cache = CONTENT_CACHE.get_or_init(Default::default).lock().unwrap();
|
let mut cache = CONTENT_CACHE.get_or_init(Default::default).lock().unwrap();
|
||||||
let r = cache.source_code.get(&path).map(|r| r.clone());
|
let r = cache.source_code.get(&path).cloned();
|
||||||
cache.dependency.insert(path);
|
cache.dependency.insert(path);
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue