cargo fmt

This commit is contained in:
elipeter 2026-05-21 14:35:42 -05:00
parent bec7bbf96c
commit 3a35cd6c8f
294 changed files with 6809 additions and 3911 deletions

View file

@ -8,9 +8,7 @@
//! to the handler does not matter. Methods are picked up from the
//! `methods=[...]` kwarg when present and default to `GET`.
use crate::dynamic::framework::{
FrameworkAdapter, FrameworkBinding, HttpMethod, RouteShape,
};
use crate::dynamic::framework::{FrameworkAdapter, FrameworkBinding, HttpMethod, RouteShape};
use crate::evidence::EntryKind;
use crate::summary::FuncSummary;
use crate::symbol::Lang;
@ -50,12 +48,13 @@ fn walk_routes(node: Node<'_>, bytes: &[u8], target: &str, out: &mut Option<(Htt
let last = callee.rsplit_once('.').map(|(_, s)| s).unwrap_or(callee);
if matches!(last, "Route" | "WebSocketRoute")
&& let Some(args) = node.child_by_field_name("arguments")
&& let Some(path) = first_string_arg(args, bytes)
&& endpoint_references(args, bytes, target) {
let method = methods_kwarg(args, bytes).unwrap_or(HttpMethod::GET);
*out = Some((method, path));
return;
}
&& let Some(path) = first_string_arg(args, bytes)
&& endpoint_references(args, bytes, target)
{
let method = methods_kwarg(args, bytes).unwrap_or(HttpMethod::GET);
*out = Some((method, path));
return;
}
}
let mut cur = node.walk();
for child in node.children(&mut cur) {
@ -76,9 +75,10 @@ fn endpoint_references(args: Node<'_>, bytes: &[u8], target: &str) -> bool {
};
if name_text == "endpoint"
&& let Some(value) = arg.child_by_field_name("value")
&& identifier_matches(value, bytes, target) {
return true;
}
&& identifier_matches(value, bytes, target)
{
return true;
}
} else {
seen_positional += 1;
// Second positional argument is the endpoint when no
@ -204,8 +204,10 @@ mod tests {
fn skips_when_starlette_not_imported() {
let src: &[u8] = b"def homepage(request):\n return None\n";
let tree = parse(src);
assert!(PythonStarletteAdapter
.detect(&summary("homepage"), tree.root_node(), src)
.is_none());
assert!(
PythonStarletteAdapter
.detect(&summary("homepage"), tree.root_node(), src)
.is_none()
);
}
}