(call)
function calls
clojure
(call receiver? args?)Where:
- receiver: callee expression (the
fooinfoo(), or use(mem ...)forvalue.method()calls) * - args: arguments supplied to the call *
Matching:
- free function calls, e.g.
foo() - method calls, e.g.
value.method() - macro invocations, e.g.
macro!(...)
Behavior
- Macro invocations are matched by name only; argument matching is ignored for macros.
- Bare
(call)does not match macro invocations; provide a receiver to match them.
Examples
Find unwrap calls that can panic at runtime.
clojure
(call (mem unwrap))Selects in lines { 1 } but not in { 2 }:
rust
let value = option.unwrap();
let value = option.expect("missing");Find read_to_string calls that pass a literal manifest path.
clojure
(call (id read_to_string) (arg 1 (str /\.toml$/)))Selects in lines { 1 } but not in { 2 }:
rust
let manifest = std::fs::read_to_string("Cargo.toml");
let data = std::fs::read_to_string(path);Audit uses of include_str! for embedded assets.
clojure
(call (id include_str))Selects in lines { 1 } but not in { 2 }:
rust
const BANNER: &str = include_str!("banner.txt");
let msg = format!("hi");Arguments
receiver
• Identifier: shorthand for (id)
• Pattern: shorthand for (id)
• (:kind) • (:ref) • (:text) • (call) • (enum) • (fun) • (id) • (mem) • (num) • (str) • (:into) • (:and) • (:or) • (:not) • (:replace) • (:capture)
args
• (arg)
• (:into) • (:and) • (:or) • (:not) • (:text) • (:kind) • (:replace) • (:capture)