Skip to content

Commit

Permalink
Minor code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Jul 29, 2024
1 parent 286a34e commit 8aaa432
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/core/src/routing/filters/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ impl PathParser {
let mut scaned = self.scan_wisps()?;
if scaned.len() > 1 {
wisps.push(CombWisp(scaned).into());
} else if !scaned.is_empty() {
wisps.push(scaned.pop().expect("scan parts is empty"));
} else if let Some(wisp) = scaned.pop() {
wisps.push(wisp);
} else {
return Err("scan parts is empty".to_owned());
}
Expand Down
2 changes: 2 additions & 0 deletions crates/oapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,11 @@ impl ToSchema for serde_json::Map<String, serde_json::Value> {
/// static METADATA: Metadata = Metadata::new("");
/// &METADATA
/// }
/// #[allow(refining_impl_trait)]
/// async fn extract(req: &'ex mut Request) -> Result<Self, salvo_core::http::ParseError> {
/// salvo_core::serde::from_request(req, Self::metadata()).await
/// }
/// #[allow(refining_impl_trait)]
/// async fn extract_with_arg(req: &'ex mut Request, _arg: &str) -> Result<Self, salvo_core::http::ParseError> {
/// Self::extract(req).await
/// }
Expand Down

0 comments on commit 8aaa432

Please sign in to comment.