Enable clippy::unnecessary_unwrap
(#8756)
This PR enables the [`clippy::unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_unwrap) rule and fixes the outstanding violations. Release Notes: - N/A
This commit is contained in:
parent
191fcf67d1
commit
373e18bc88
4 changed files with 15 additions and 15 deletions
|
@ -19,11 +19,9 @@ pub struct Embedding(pub Vec<f32>);
|
||||||
impl FromSql for Embedding {
|
impl FromSql for Embedding {
|
||||||
fn column_result(value: ValueRef) -> FromSqlResult<Self> {
|
fn column_result(value: ValueRef) -> FromSqlResult<Self> {
|
||||||
let bytes = value.as_blob()?;
|
let bytes = value.as_blob()?;
|
||||||
let embedding: Result<Vec<f32>, Box<bincode::ErrorKind>> = bincode::deserialize(bytes);
|
let embedding =
|
||||||
if embedding.is_err() {
|
bincode::deserialize(bytes).map_err(|err| rusqlite::types::FromSqlError::Other(err))?;
|
||||||
return Err(rusqlite::types::FromSqlError::Other(embedding.unwrap_err()));
|
Ok(Embedding(embedding))
|
||||||
}
|
|
||||||
Ok(Embedding(embedding.unwrap()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,10 @@ impl<M: ManagedView> PopoverMenu<M> {
|
||||||
|
|
||||||
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
||||||
if modal.focus_handle(cx).contains_focused(cx) {
|
if modal.focus_handle(cx).contains_focused(cx) {
|
||||||
if previous_focus_handle.is_some() {
|
if let Some(previous_focus_handle) =
|
||||||
cx.focus(previous_focus_handle.as_ref().unwrap())
|
previous_focus_handle.as_ref()
|
||||||
|
{
|
||||||
|
cx.focus(previous_focus_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*menu2.borrow_mut() = None;
|
*menu2.borrow_mut() = None;
|
||||||
|
|
|
@ -154,8 +154,8 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
||||||
|
|
||||||
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
cx.subscribe(&new_menu, move |modal, _: &DismissEvent, cx| {
|
||||||
if modal.focus_handle(cx).contains_focused(cx) {
|
if modal.focus_handle(cx).contains_focused(cx) {
|
||||||
if previous_focus_handle.is_some() {
|
if let Some(previous_focus_handle) = previous_focus_handle.as_ref() {
|
||||||
cx.focus(previous_focus_handle.as_ref().unwrap())
|
cx.focus(previous_focus_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*menu2.borrow_mut() = None;
|
*menu2.borrow_mut() = None;
|
||||||
|
@ -165,8 +165,9 @@ impl<M: ManagedView> Element for RightClickMenu<M> {
|
||||||
cx.focus_view(&new_menu);
|
cx.focus_view(&new_menu);
|
||||||
*menu.borrow_mut() = Some(new_menu);
|
*menu.borrow_mut() = Some(new_menu);
|
||||||
|
|
||||||
*position.borrow_mut() = if attach.is_some() && child_layout_id.is_some() {
|
*position.borrow_mut() =
|
||||||
attach.unwrap().corner(child_bounds)
|
if let Some(attach) = attach.filter(|_| child_layout_id.is_some()) {
|
||||||
|
attach.corner(child_bounds)
|
||||||
} else {
|
} else {
|
||||||
cx.mouse_position()
|
cx.mouse_position()
|
||||||
};
|
};
|
||||||
|
|
|
@ -112,7 +112,6 @@ fn run_clippy(args: ClippyArgs) -> Result<()> {
|
||||||
"clippy::suspicious_to_owned",
|
"clippy::suspicious_to_owned",
|
||||||
"clippy::type_complexity",
|
"clippy::type_complexity",
|
||||||
"clippy::unnecessary_to_owned",
|
"clippy::unnecessary_to_owned",
|
||||||
"clippy::unnecessary_unwrap",
|
|
||||||
"clippy::useless_conversion",
|
"clippy::useless_conversion",
|
||||||
"clippy::useless_format",
|
"clippy::useless_format",
|
||||||
"clippy::vec_init_then_push",
|
"clippy::vec_init_then_push",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue