| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0d492a6 commit fe2c9bf
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,7 +71,7 @@ pub fn benchmark_file_parsing(group: &mut BenchmarkGroup<WallTime>, name: &str, | |||
| 71 | 71 | pub fn benchmark_pystone(group: &mut BenchmarkGroup<WallTime>, contents: String) { | |
| 72 | 72 | // Default is 50_000. This takes a while, so reduce it to 30k. | |
| 73 | 73 | for idx in (10_000..=30_000).step_by(10_000) { | |
| 74 | - let code_with_loops = format!("LOOPS = {}\n{}", idx, contents); | ||
| 74 | + let code_with_loops = format!("LOOPS = {idx}\n{contents}"); | ||
| 75 | 75 | let code_str = code_with_loops.as_str(); | |
| 76 | 76 | ||
| 77 | 77 | group.throughput(Throughput::Elements(idx as u64)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,7 +261,7 @@ fn test_to_hex() { | |||
| 261 | 261 | // println!("{} -> {}", f, hex); | |
| 262 | 262 | let roundtrip = hexf_parse::parse_hexf64(&hex, false).unwrap(); | |
| 263 | 263 | // println!(" -> {}", roundtrip); | |
| 264 | - assert!(f == roundtrip, "{} {} {}", f, hex, roundtrip); | ||
| 264 | + assert!(f == roundtrip, "{f} {hex} {roundtrip}"); | ||
| 265 | 265 | } | |
| 266 | 266 | } | |
| 267 | 267 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,7 +59,7 @@ fn main() -> Result<(), lexopt::Error> { | |||
| 59 | 59 | if script.exists() && script.is_file() { | |
| 60 | 60 | let res = display_script(script, mode, opts.clone(), expand_code_objects); | |
| 61 | 61 | if let Err(e) = res { | |
| 62 | - error!("Error while compiling {:?}: {}", script, e); | ||
| 62 | + error!("Error while compiling {script:?}: {e}"); | ||
| 63 | 63 | } | |
| 64 | 64 | } else { | |
| 65 | 65 | eprintln!("{script:?} is not a file."); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,9 +41,9 @@ fn main() { | |||
| 41 | 41 | ||
| 42 | 42 | fn parse_folder(path: &Path) -> std::io::Result<Vec<ParsedFile>> { | |
| 43 | 43 | let mut res = vec![]; | |
| 44 | - info!("Parsing folder of python code: {:?}", path); | ||
| 44 | + info!("Parsing folder of python code: {path:?}"); | ||
| 45 | 45 | for entry in path.read_dir()? { | |
| 46 | - debug!("Entry: {:?}", entry); | ||
| 46 | + debug!("Entry: {entry:?}"); | ||
| 47 | 47 | let entry = entry?; | |
| 48 | 48 | let metadata = entry.metadata()?; | |
| 49 | 49 | ||
@@ -56,7 +56,7 @@ fn parse_folder(path: &Path) -> std::io::Result<Vec<ParsedFile>> { | |||
| 56 | 56 | let parsed_file = parse_python_file(&path); | |
| 57 | 57 | match &parsed_file.result { | |
| 58 | 58 | Ok(_) => {} | |
| 59 | - Err(y) => error!("Erreur in file {:?} {:?}", path, y), | ||
| 59 | + Err(y) => error!("Erreur in file {path:?} {y:?}"), | ||
| 60 | 60 | } | |
| 61 | 61 | ||
| 62 | 62 | res.push(parsed_file); | |
@@ -66,7 +66,7 @@ fn parse_folder(path: &Path) -> std::io::Result<Vec<ParsedFile>> { | |||
| 66 | 66 | } | |
| 67 | 67 | ||
| 68 | 68 | fn parse_python_file(filename: &Path) -> ParsedFile { | |
| 69 | - info!("Parsing file {:?}", filename); | ||
| 69 | + info!("Parsing file {filename:?}"); | ||
| 70 | 70 | match std::fs::read_to_string(filename) { | |
| 71 | 71 | Err(e) => ParsedFile { | |
| 72 | 72 | num_lines: 0, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,7 +172,7 @@ impl StackMachine { | |||
| 172 | 172 | if let Some(StackValue::Function(function)) = self.locals.get(name) { | |
| 173 | 173 | function.clone() | |
| 174 | 174 | } else { | |
| 175 | - panic!("There was no function named {}", name) | ||
| 175 | + panic!("There was no function named {name}") | ||
| 176 | 176 | } | |
| 177 | 177 | } | |
| 178 | 178 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -601,7 +601,7 @@ mod array { | |||
| 601 | 601 | ||
| 602 | 602 | fn try_from(ch: WideChar) -> Result<Self, Self::Error> { | |
| 603 | 603 | // safe because every configuration of bytes for the types we support are valid | |
| 604 | - u32_to_char(ch.0 as u32) | ||
| 604 | + u32_to_char(ch.0 as _) | ||
| 605 | 605 | } | |
| 606 | 606 | } | |
| 607 | 607 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -388,10 +388,9 @@ pub fn subs_parameters<F: Fn(&VirtualMachine) -> PyResult<String>>( | |||
| 388 | 388 | new_args.push(substituted); | |
| 389 | 389 | } else { | |
| 390 | 390 | // CPython doesn't support default values in this context | |
| 391 | - return Err(vm.new_type_error(format!( | ||
| 392 | - "No argument provided for parameter at index {}", | ||
| 393 | - idx | ||
| 394 | - ))); | ||
| 391 | + return Err( | ||
| 392 | + vm.new_type_error(format!("No argument provided for parameter at index {idx}")) | ||
| 393 | + ); | ||
| 395 | 394 | } | |
| 396 | 395 | } else { | |
| 397 | 396 | new_args.push(subs_tvars(arg.clone(), ¶meters, arg_items, vm)?); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -349,7 +349,10 @@ impl ExecutingFrame<'_> { | |||
| 349 | 349 | } | |
| 350 | 350 | ||
| 351 | 351 | fn run(&mut self, vm: &VirtualMachine) -> PyResult<ExecutionResult> { | |
| 352 | - flame_guard!(format!("Frame::run({})", self.code.obj_name)); | ||
| 352 | + flame_guard!(format!( | ||
| 353 | + "Frame::run({obj_name})", | ||
| 354 | + obj_name = self.code.obj_name | ||
| 355 | + )); | ||
| 353 | 356 | // Execute until return or exception: | |
| 354 | 357 | let instructions = &self.code.instructions; | |
| 355 | 358 | let mut arg_state = bytecode::OpArgState::default(); | |
@@ -941,7 +944,7 @@ impl ExecutingFrame<'_> { | |||
| 941 | 944 | .get_attr(identifier!(vm, __exit__), vm) | |
| 942 | 945 | .map_err(|_exc| { | |
| 943 | 946 | vm.new_type_error({ | |
| 944 | - format!("'{} (missed __exit__ method)", error_string()) | ||
| 947 | + format!("{} (missed __exit__ method)", error_string()) | ||
| 945 | 948 | }) | |
| 946 | 949 | })?; | |
| 947 | 950 | self.push_value(exit); | |
@@ -968,7 +971,7 @@ impl ExecutingFrame<'_> { | |||
| 968 | 971 | .get_attr(identifier!(vm, __aexit__), vm) | |
| 969 | 972 | .map_err(|_exc| { | |
| 970 | 973 | vm.new_type_error({ | |
| 971 | - format!("'{} (missed __aexit__ method)", error_string()) | ||
| 974 | + format!("{} (missed __aexit__ method)", error_string()) | ||
| 972 | 975 | }) | |
| 973 | 976 | })?; | |
| 974 | 977 | self.push_value(aexit); | |
@@ -1638,7 +1641,7 @@ impl ExecutingFrame<'_> { | |||
| 1638 | 1641 | F: FnMut(PyObjectRef) -> PyResult<()>, | |
| 1639 | 1642 | { | |
| 1640 | 1643 | let Some(keys_method) = vm.get_method(mapping.clone(), vm.ctx.intern_str("keys")) else { | |
| 1641 | - return Err(vm.new_type_error(format!("{} must be a mapping", error_prefix))); | ||
| 1644 | + return Err(vm.new_type_error(format!("{error_prefix} must be a mapping"))); | ||
| 1642 | 1645 | }; | |
| 1643 | 1646 | ||
| 1644 | 1647 | let keys = keys_method?.call((), vm)?.get_iter(vm)?; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -286,7 +286,10 @@ mod _functools { | |||
| 286 | 286 | key.str(vm)?.as_str().to_owned() | |
| 287 | 287 | }; | |
| 288 | 288 | let value_str = value.repr(vm)?; | |
| 289 | - parts.push(format!("{}={}", key_part, value_str.as_str())); | ||
| 289 | + parts.push(format!( | ||
| 290 | + "{key_part}={value_str}", | ||
| 291 | + value_str = value_str.as_str() | ||
| 292 | + )); | ||
| 290 | 293 | } | |
| 291 | 294 | ||
| 292 | 295 | let class_name = zelf.class().name(); | |
@@ -306,14 +309,17 @@ mod _functools { | |||
| 306 | 309 | // For test modules, just use the class name without module prefix | |
| 307 | 310 | class_name.to_owned() | |
| 308 | 311 | } | |
| 309 | - _ => format!("{}.{}", module_name, class_name), | ||
| 312 | + _ => format!("{module_name}.{class_name}"), | ||
| 310 | 313 | } | |
| 311 | 314 | } | |
| 312 | 315 | Err(_) => class_name.to_owned(), | |
| 313 | 316 | } | |
| 314 | 317 | }; | |
| 315 | 318 | ||
| 316 | - Ok(format!("{}({})", qualified_name, parts.join(", "))) | ||
| 319 | + Ok(format!( | ||
| 320 | + "{qualified_name}({parts})", | ||
| 321 | + parts = parts.join(", ") | ||
| 322 | + )) | ||
| 317 | 323 | } else { | |
| 318 | 324 | Ok("...".to_owned()) | |
| 319 | 325 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -373,11 +373,10 @@ mod sys { | |||
| 373 | 373 | let type_name = exc_val.class().name(); | |
| 374 | 374 | // TODO: fix error message | |
| 375 | 375 | let msg = format!( | |
| 376 | - "TypeError: print_exception(): Exception expected for value, {} found\n", | ||
| 377 | - type_name | ||
| 376 | + "TypeError: print_exception(): Exception expected for value, {type_name} found\n" | ||
| 378 | 377 | ); | |
| 379 | 378 | use crate::py_io::Write; | |
| 380 | - write!(&mut crate::py_io::PyWriter(stderr, vm), "{}", msg)?; | ||
| 379 | + write!(&mut crate::py_io::PyWriter(stderr, vm), "{msg}")?; | ||
| 381 | 380 | Ok(()) | |
| 382 | 381 | } | |
| 383 | 382 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments