(body: &'a [ast::Stmt], opts: &CompileOpts)
| 10489 | } |
| 10490 | |
| 10491 | fn split_doc<'a>(body: &'a [ast::Stmt], opts: &CompileOpts) -> (Option<String>, &'a [ast::Stmt]) { |
| 10492 | if let Some((ast::Stmt::Expr(expr), body_rest)) = body.split_first() { |
| 10493 | let doc_comment = match &*expr.value { |
| 10494 | ast::Expr::StringLiteral(value) => Some(&value.value), |
| 10495 | // f-strings are not allowed in Python doc comments. |
| 10496 | ast::Expr::FString(_) => None, |
| 10497 | _ => None, |
| 10498 | }; |
| 10499 | if let Some(doc) = doc_comment { |
| 10500 | return if opts.optimize < 2 { |
| 10501 | (Some(clean_doc(doc.to_str())), body_rest) |
| 10502 | } else { |
| 10503 | (None, body_rest) |
| 10504 | }; |
| 10505 | } |
| 10506 | } |
| 10507 | (None, body) |
| 10508 | } |
| 10509 | |
| 10510 | pub fn ruff_int_to_bigint(int: &ast::Int) -> Result<BigInt, CodegenErrorType> { |
| 10511 | if let Some(small) = int.as_u64() { |
no test coverage detected