mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
clippy assigning_clones
This commit is contained in:
1 parent
0009dd6f07
commit
afc11890b9
5 files changed
+11
-9
No files matched your search
@@ -378,6 +378,7 @@ use_self = "warn"
|
||||
useless_let_if_seq = "warn"
|
||||
|
||||
# pedantic lints to enforce gradually
|
||||
assigning_clones = "warn"
|
||||
bool_to_int_with_if = "warn"
|
||||
checked_conversions = "warn"
|
||||
cloned_instead_of_copied = "warn"
|
||||
|
||||
@@ -2073,7 +2073,7 @@ impl<'warnings> Compiler<'warnings> {
|
||||
|
||||
fn expose_annotation_format_parameter(code: &mut CodeObject) {
|
||||
if let Some(first) = code.varnames.first_mut() {
|
||||
*first = "format".to_owned();
|
||||
*first = String::from("format");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1632,8 +1632,9 @@ impl SymbolTableBuilder {
|
||||
}
|
||||
|
||||
if type_params.is_none() {
|
||||
self.class_name = prev_class.clone();
|
||||
self.class_name.clone_from(&prev_class);
|
||||
}
|
||||
|
||||
if let Some(arguments) = arguments {
|
||||
self.scan_expressions(&arguments.args, ExpressionContext::Load)?;
|
||||
for keyword in &arguments.keywords {
|
||||
|
||||
@@ -121,7 +121,7 @@ pub fn init_path_config(settings: &Settings) -> Paths {
|
||||
// - sys.executable should be the launcher path (where user invoked Python)
|
||||
// - sys._base_executable should be the real Python executable
|
||||
let exe_dir = if let Ok(launcher) = crate::host_env::os::var("__PYVENV_LAUNCHER__") {
|
||||
paths.executable = launcher.clone();
|
||||
paths.executable.clone_from(&launcher);
|
||||
paths.base_executable = real_executable;
|
||||
PathBuf::from(&launcher).parent().map(PathBuf::from)
|
||||
} else {
|
||||
@@ -152,7 +152,7 @@ pub fn init_path_config(settings: &Settings) -> Paths {
|
||||
paths.base_prefix = calculated_prefix;
|
||||
} else {
|
||||
// Not in venv: prefix == base_prefix
|
||||
paths.prefix = calculated_prefix.clone();
|
||||
paths.prefix.clone_from(&calculated_prefix);
|
||||
paths.base_prefix = calculated_prefix;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ pub fn init_path_config(settings: &Settings) -> Paths {
|
||||
} else {
|
||||
calculate_exec_prefix(search_dir.as_ref(), paths.prefix.as_ref())
|
||||
};
|
||||
paths.base_exec_prefix = paths.base_prefix.clone();
|
||||
paths.base_exec_prefix.clone_from(&paths.base_prefix);
|
||||
|
||||
// Step 7: Calculate base_executable (if not already set by __PYVENV_LAUNCHER__)
|
||||
if paths.base_executable.is_empty() {
|
||||
|
||||
@@ -794,10 +794,10 @@ impl VirtualMachine {
|
||||
};
|
||||
|
||||
if syntax_error_type.is(self.ctx.exceptions.tab_error) {
|
||||
syntax_error_info.msg = "inconsistent use of tabs and spaces in indentation".to_owned();
|
||||
}
|
||||
if syntax_error_type.is(self.ctx.exceptions.incomplete_input_error) {
|
||||
syntax_error_info.msg = "incomplete input".to_owned();
|
||||
syntax_error_info.msg =
|
||||
String::from("inconsistent use of tabs and spaces in indentation");
|
||||
} else if syntax_error_type.is(self.ctx.exceptions.incomplete_input_error) {
|
||||
syntax_error_info.msg = String::from("incomplete input");
|
||||
}
|
||||
|
||||
let SyntaxErrorInfo { msg, narrow_caret } = syntax_error_info;
|
||||
|
||||
Reference in new issue
Block a user