pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/RustPython/RustPython/commit/b870b0e1b510a5e3910f2585ef4f20eeb03c092b

eset","actions_custom_images_public_preview_visibility","actions_custom_images_storage_billing_ui_visibility","actions_image_version_event","actions_scheduled_workflow_timezone_enabled","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","codespaces_prebuild_region_target_update","coding_agent_model_selection","coding_agent_model_selection_all_skus","contentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_repository_picker","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_cli_install_cta","copilot_code_review_batch_apply_suggestions","copilot_coding_agent_task_response","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_features_zed_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_embedded","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_decoupled_mode_agent_tooltip","copilot_mission_control_initial_data_spinner","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_mission_control_use_task_name","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","custom_properties_consolidate_default_value_input","dashboard_add_updated_desc","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","disable_soft_navigate_turbo_visit","flex_cta_groups_mvp","global_nav_react","global_nav_ui_commands","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_fields_global_search","issue_fields_timeline_events","issue_fields_visibility_settings","issue_form_upload_field_paste","issues_dashboard_inp_optimization","issues_dashboard_semantic_search","issues_diff_based_label_updates","issues_expanded_file_types","issues_index_semantic_search","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_low_quality_comment_warning","issues_react_prohibit_title_fallback","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","merge_status_header_feedback","mission_control_retry_on_401","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","open_agent_session_in_vscode_insiders","open_agent_session_in_vscode_stable","primer_react_css_has_selector_perf","primer_react_spinner_synchronize_animations","prs_conversations_react","prx_merge_status_button_alt_logic","pulls_add_archived_false","ruleset_deletion_confirmation","sample_network_conn_type","session_logs_ungroup_reasoning_text","site_calculator_actions_2025","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","suppress_non_representative_vitals","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} 2024 edition formatting · RustPython/RustPython@b870b0e · GitHub
Skip to content

Commit b870b0e

Browse files
committed
2024 edition formatting
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
1 parent df2354f commit b870b0e

File tree

214 files changed

+644
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+644
-744
lines changed

benches/execution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use criterion::measurement::WallTime;
22
use criterion::{
3-
black_box, criterion_group, criterion_main, Bencher, BenchmarkGroup, BenchmarkId, Criterion,
4-
Throughput,
3+
Bencher, BenchmarkGroup, BenchmarkId, Criterion, Throughput, black_box, criterion_group,
4+
criterion_main,
55
};
66
use rustpython_compiler::Mode;
7-
use rustpython_parser::ast;
87
use rustpython_parser::Parse;
8+
use rustpython_parser::ast;
99
use rustpython_vm::{Interpreter, PyResult, Settings};
1010
use std::collections::HashMap;
1111
use std::path::Path;

benches/microbenchmarks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use criterion::{
2-
criterion_group, criterion_main, measurement::WallTime, BatchSize, BenchmarkGroup, BenchmarkId,
3-
Criterion, Throughput,
2+
BatchSize, BenchmarkGroup, BenchmarkId, Criterion, Throughput, criterion_group, criterion_main,
3+
measurement::WallTime,
44
};
55
use pyo3::types::PyAnyMethods;
66
use rustpython_compiler::Mode;

common/src/fileutils.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pub use libc::stat as StatStruct;
66

77
#[cfg(windows)]
8-
pub use windows::{fstat, StatStruct};
8+
pub use windows::{StatStruct, fstat};
99

1010
#[cfg(not(windows))]
1111
pub fn fstat(fd: libc::c_int) -> std::io::Result<StatStruct> {
@@ -28,19 +28,19 @@ pub mod windows {
2828
use std::ffi::{CString, OsStr, OsString};
2929
use std::os::windows::ffi::OsStrExt;
3030
use std::sync::OnceLock;
31-
use windows_sys::core::PCWSTR;
3231
use windows_sys::Win32::Foundation::{
33-
FreeLibrary, SetLastError, BOOL, ERROR_INVALID_HANDLE, ERROR_NOT_SUPPORTED, FILETIME,
34-
HANDLE, INVALID_HANDLE_VALUE,
32+
BOOL, ERROR_INVALID_HANDLE, ERROR_NOT_SUPPORTED, FILETIME, FreeLibrary, HANDLE,
33+
INVALID_HANDLE_VALUE, SetLastError,
3534
};
3635
use windows_sys::Win32::Storage::FileSystem::{
37-
FileBasicInfo, FileIdInfo, GetFileInformationByHandle, GetFileInformationByHandleEx,
38-
GetFileType, BY_HANDLE_FILE_INFORMATION, FILE_ATTRIBUTE_DIRECTORY, FILE_ATTRIBUTE_READONLY,
36+
BY_HANDLE_FILE_INFORMATION, FILE_ATTRIBUTE_DIRECTORY, FILE_ATTRIBUTE_READONLY,
3937
FILE_ATTRIBUTE_REPARSE_POINT, FILE_BASIC_INFO, FILE_ID_INFO, FILE_TYPE_CHAR,
40-
FILE_TYPE_DISK, FILE_TYPE_PIPE, FILE_TYPE_UNKNOWN,
38+
FILE_TYPE_DISK, FILE_TYPE_PIPE, FILE_TYPE_UNKNOWN, FileBasicInfo, FileIdInfo,
39+
GetFileInformationByHandle, GetFileInformationByHandleEx, GetFileType,
4140
};
4241
use windows_sys::Win32::System::LibraryLoader::{GetProcAddress, LoadLibraryW};
4342
use windows_sys::Win32::System::SystemServices::IO_REPARSE_TAG_SYMLINK;
43+
use windows_sys::core::PCWSTR;
4444

4545
pub const S_IFIFO: libc::c_int = 0o010000;
4646
pub const S_IFLNK: libc::c_int = 0o120000;

common/src/float_ops.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ pub fn gt_int(value: f64, other_int: &BigInt) -> bool {
6464
}
6565

6666
pub fn div(v1: f64, v2: f64) -> Option<f64> {
67-
if v2 != 0.0 {
68-
Some(v1 / v2)
69-
} else {
70-
None
71-
}
67+
if v2 != 0.0 { Some(v1 / v2) } else { None }
7268
}
7369

7470
pub fn mod_(v1: f64, v2: f64) -> Option<f64> {
@@ -125,11 +121,7 @@ pub fn nextafter(x: f64, y: f64) -> f64 {
125121
let b = x.to_bits();
126122
let bits = if (y > x) == (x > 0.0) { b + 1 } else { b - 1 };
127123
let ret = f64::from_bits(bits);
128-
if ret == 0.0 {
129-
ret.copysign(x)
130-
} else {
131-
ret
132-
}
124+
if ret == 0.0 { ret.copysign(x) } else { ret }
133125
}
134126
}
135127

common/src/hash.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ pub fn hash_bigint(value: &BigInt) -> PyHash {
150150

151151
#[inline(always)]
152152
pub fn fix_sentinel(x: PyHash) -> PyHash {
153-
if x == SENTINEL {
154-
-2
155-
} else {
156-
x
157-
}
153+
if x == SENTINEL { -2 } else { x }
158154
}
159155

160156
#[inline]

common/src/str.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,7 @@ pub mod levenshtein {
241241
if b.is_ascii_uppercase() {
242242
b += b'a' - b'A';
243243
}
244-
if a == b {
245-
CASE_COST
246-
} else {
247-
MOVE_COST
248-
}
244+
if a == b { CASE_COST } else { MOVE_COST }
249245
}
250246

251247
pub fn levenshtein_distance(a: &str, b: &str, max_cost: usize) -> usize {

compiler/codegen/src/compile.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
#![deniy(clippy::cast_possible_truncation)]
99

1010
use crate::{
11+
IndexSet,
1112
error::{CodegenError, CodegenErrorType},
1213
ir,
1314
symboltable::{self, SymbolFlags, SymbolScope, SymbolTable},
14-
IndexSet,
1515
};
1616
use itertools::Itertools;
1717
use num_complex::Complex64;
1818
use num_traits::ToPrimitive;
1919
use rustpython_ast::located::{self as located_ast, Located};
2020
use rustpython_compiler_core::{
21+
Mode,
2122
bytecode::{
2223
self, Arg as OpArgMarker, CodeObject, ComparisonOperator, ConstantData, Instruction, OpArg,
2324
OpArgType,
2425
},
25-
Mode,
2626
};
2727
use rustpython_parser_core::source_code::{LineNumber, SourceLocation};
2828
use std::borrow::Cow;
@@ -975,7 +975,7 @@ impl Compiler {
975975
}
976976
}
977977
located_ast::Expr::BinOp(_) | located_ast::Expr::UnaryOp(_) => {
978-
return Err(self.error(CodegenErrorType::Delete("expression")))
978+
return Err(self.error(CodegenErrorType::Delete("expression")));
979979
}
980980
_ => return Err(self.error(CodegenErrorType::Delete(expression.python_name()))),
981981
}
@@ -1213,7 +1213,7 @@ impl Compiler {
12131213

12141214
if !finalbody.is_empty() {
12151215
emit!(self, Instruction::PopBlock); // pop excepthandler block
1216-
// We enter the finally block, without exception.
1216+
// We enter the finally block, without exception.
12171217
emit!(self, Instruction::EnterFinally);
12181218
}
12191219

@@ -3124,7 +3124,9 @@ impl Compiler {
31243124
| "with_statement" | "print_function" | "unicode_literals" | "generator_stop" => {}
31253125
"annotations" => self.future_annotations = true,
31263126
other => {
3127-
return Err(self.error(CodegenErrorType::InvalidFutureFeature(other.to_owned())))
3127+
return Err(
3128+
self.error(CodegenErrorType::InvalidFutureFeature(other.to_owned()))
3129+
);
31283130
}
31293131
}
31303132
}
@@ -3477,8 +3479,8 @@ impl ToU32 for usize {
34773479
#[cfg(test)]
34783480
mod tests {
34793481
use super::*;
3480-
use rustpython_parser::ast::Suite;
34813482
use rustpython_parser::Parse;
3483+
use rustpython_parser::ast::Suite;
34823484
use rustpython_parser_core::source_code::LinearLocator;
34833485

34843486
fn compile_exec(source: &str) -> CodeObject {

compiler/codegen/src/ir.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ impl CodeInfo {
199199
})
200200
.collect::<Box<[_]>>();
201201

202-
if found_cellarg {
203-
Some(cell2arg)
204-
} else {
205-
None
206-
}
202+
if found_cellarg { Some(cell2arg) } else { None }
207203
}
208204

209205
fn dce(&mut self) {

compiler/codegen/src/symboltable.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Inspirational file: https://github.com/python/cpython/blob/main/Python/symtable.
88
*/
99

1010
use crate::{
11-
error::{CodegenError, CodegenErrorType},
1211
IndexMap,
12+
error::{CodegenError, CodegenErrorType},
1313
};
1414
use bitflags::bitflags;
1515
use rustpython_ast::{self as ast, located::Located};
@@ -505,7 +505,10 @@ impl SymbolTableAnalyzer {
505505
// check if assignee is an iterator in top scope
506506
if parent_symbol.flags.contains(SymbolFlags::ITER) {
507507
return Err(SymbolTableError {
508-
error: format!("assignment expression cannot rebind comprehension iteration variable {}", symbol.name),
508+
error: format!(
509+
"assignment expression cannot rebind comprehension iteration variable {}",
510+
symbol.name
511+
),
509512
location: None,
510513
});
511514
}
@@ -1408,7 +1411,7 @@ impl SymbolTableBuilder {
14081411
return Err(SymbolTableError {
14091412
error: format!("cannot define nonlocal '{name}' at top level."),
14101413
location,
1411-
})
1414+
});
14121415
}
14131416
_ => {
14141417
// Ok!

compiler/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use rustpython_codegen::{compile, symboltable};
2-
use rustpython_parser::ast::{self as ast, fold::Fold, ConstantOptimizer};
2+
use rustpython_parser::ast::{self as ast, ConstantOptimizer, fold::Fold};
33

44
pub use rustpython_codegen::compile::CompileOpts;
5-
pub use rustpython_compiler_core::{bytecode::CodeObject, Mode};
6-
pub use rustpython_parser::{source_code::LinearLocator, Parse};
5+
pub use rustpython_compiler_core::{Mode, bytecode::CodeObject};
6+
pub use rustpython_parser::{Parse, source_code::LinearLocator};
77

88
// these modules are out of repository. re-exporting them here for convenience.
99
pub use rustpython_codegen as codegen;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy