Replace deprecated methods

This commit is contained in:
konstin 2018-12-15 14:15:43 +01:00
parent 6d7f326176
commit 89872dceb9
4 changed files with 6 additions and 6 deletions

View File

@ -95,7 +95,7 @@ fn get_config_vars(python_path: &String) -> Result<HashMap<String, String>, Stri
}
let stdout = run_python_script(python_path, &script)?;
let split_stdout: Vec<&str> = stdout.trim_right().lines().collect();
let split_stdout: Vec<&str> = stdout.trim_end().lines().collect();
if split_stdout.len() != SYSCONFIG_VALUES.len() + SYSCONFIG_FLAGS.len() {
return Err(format!(
"python stdout len didn't return expected number of lines: {}",
@ -216,7 +216,7 @@ else:
print("static")
"#;
let out = run_python_script("python", script).unwrap();
Ok(out.trim_right().to_owned())
Ok(out.trim_end().to_owned())
}
#[cfg(target_os = "macos")]

View File

@ -146,11 +146,11 @@ fn extract_pyfn_attrs(
/// Coordinates the naming of a the add-function-to-python-module function
fn function_wrapper_ident(name: &syn::Ident) -> syn::Ident {
// Make sure this ident matches the one of wrap_function
// The trim_left_matches("r#") is for https://github.com/dtolnay/syn/issues/478
// The trim_start_matches("r#") is for https://github.com/dtolnay/syn/issues/478
syn::Ident::new(
&format!(
"__pyo3_get_function_{}",
name.to_string().trim_left_matches("r#")
name.to_string().trim_start_matches("r#")
),
Span::call_site(),
)

View File

@ -148,7 +148,7 @@ pub fn pyfunction(
// Workaround for https://github.com/dtolnay/syn/issues/478
let python_name = syn::Ident::new(
&ast.ident.to_string().trim_left_matches("r#"),
&ast.ident.to_string().trim_start_matches("r#"),
Span::call_site(),
);
let expanded = module::add_fn_to_module(&mut ast, &python_name, Vec::new());

View File

@ -16,7 +16,7 @@ pub fn indoc(commands: &str) -> String {
}
commands
.trim_right()
.trim_end()
.replace(&("\n".to_string() + &indent), "\n")
+ "\n"
}