mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Remove always-inline (#879)
This commit is contained in:
parent
9315b9f459
commit
814ddeb7ea
3 changed files with 10 additions and 11 deletions
|
@ -6,7 +6,6 @@ use rustpython_ast::{Excepthandler, ExcepthandlerKind, Expr, ExprKind, Location,
|
||||||
use crate::ast::types::Range;
|
use crate::ast::types::Range;
|
||||||
use crate::SourceCodeLocator;
|
use crate::SourceCodeLocator;
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
fn collect_call_path_inner<'a>(expr: &'a Expr, parts: &mut Vec<&'a str>) {
|
fn collect_call_path_inner<'a>(expr: &'a Expr, parts: &mut Vec<&'a str>) {
|
||||||
match &expr.node {
|
match &expr.node {
|
||||||
ExprKind::Call { func, .. } => {
|
ExprKind::Call { func, .. } => {
|
||||||
|
@ -24,7 +23,7 @@ fn collect_call_path_inner<'a>(expr: &'a Expr, parts: &mut Vec<&'a str>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert an `Expr` to its call path (like `List`, or `typing.List`).
|
/// Convert an `Expr` to its call path (like `List`, or `typing.List`).
|
||||||
#[inline(always)]
|
|
||||||
pub fn compose_call_path(expr: &Expr) -> Option<String> {
|
pub fn compose_call_path(expr: &Expr) -> Option<String> {
|
||||||
let segments = collect_call_paths(expr);
|
let segments = collect_call_paths(expr);
|
||||||
if segments.is_empty() {
|
if segments.is_empty() {
|
||||||
|
@ -35,7 +34,7 @@ pub fn compose_call_path(expr: &Expr) -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert an `Expr` to its call path segments (like ["typing", "List"]).
|
/// Convert an `Expr` to its call path segments (like ["typing", "List"]).
|
||||||
#[inline(always)]
|
|
||||||
pub fn collect_call_paths(expr: &Expr) -> Vec<&str> {
|
pub fn collect_call_paths(expr: &Expr) -> Vec<&str> {
|
||||||
let mut segments = vec![];
|
let mut segments = vec![];
|
||||||
collect_call_path_inner(expr, &mut segments);
|
collect_call_path_inner(expr, &mut segments);
|
||||||
|
|
|
@ -577,7 +577,7 @@ pub fn walk_pattern<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, pattern: &'a P
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_expr_context<'a, V: Visitor<'a> + ?Sized>(
|
pub fn walk_expr_context<'a, V: Visitor<'a> + ?Sized>(
|
||||||
visitor: &mut V,
|
visitor: &mut V,
|
||||||
expr_context: &'a ExprContext,
|
expr_context: &'a ExprContext,
|
||||||
|
@ -585,21 +585,21 @@ pub fn walk_expr_context<'a, V: Visitor<'a> + ?Sized>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_boolop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, boolop: &'a Boolop) {}
|
pub fn walk_boolop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, boolop: &'a Boolop) {}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_operator<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, operator: &'a Operator) {}
|
pub fn walk_operator<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, operator: &'a Operator) {}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_unaryop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, unaryop: &'a Unaryop) {}
|
pub fn walk_unaryop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, unaryop: &'a Unaryop) {}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_cmpop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, cmpop: &'a Cmpop) {}
|
pub fn walk_cmpop<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, cmpop: &'a Cmpop) {}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[inline(always)]
|
|
||||||
pub fn walk_alias<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, alias: &'a Alias) {}
|
pub fn walk_alias<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, alias: &'a Alias) {}
|
||||||
|
|
|
@ -128,7 +128,7 @@ impl<'a> Checker<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a `Check` to the `Checker`.
|
/// Add a `Check` to the `Checker`.
|
||||||
#[inline(always)]
|
|
||||||
pub(crate) fn add_check(&mut self, check: Check) {
|
pub(crate) fn add_check(&mut self, check: Check) {
|
||||||
// If we're in an f-string, override the location. RustPython doesn't produce
|
// If we're in an f-string, override the location. RustPython doesn't produce
|
||||||
// reliable locations for expressions within f-strings, so we use the
|
// reliable locations for expressions within f-strings, so we use the
|
||||||
|
@ -145,7 +145,7 @@ impl<'a> Checker<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add multiple `Check` items to the `Checker`.
|
/// Add multiple `Check` items to the `Checker`.
|
||||||
#[inline(always)]
|
|
||||||
pub(crate) fn add_checks(&mut self, checks: impl Iterator<Item = Check>) {
|
pub(crate) fn add_checks(&mut self, checks: impl Iterator<Item = Check>) {
|
||||||
for check in checks {
|
for check in checks {
|
||||||
self.add_check(check);
|
self.add_check(check);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue