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 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() { if split_stdout.len() != SYSCONFIG_VALUES.len() + SYSCONFIG_FLAGS.len() {
return Err(format!( return Err(format!(
"python stdout len didn't return expected number of lines: {}", "python stdout len didn't return expected number of lines: {}",
@ -216,7 +216,7 @@ else:
print("static") print("static")
"#; "#;
let out = run_python_script("python", script).unwrap(); let out = run_python_script("python", script).unwrap();
Ok(out.trim_right().to_owned()) Ok(out.trim_end().to_owned())
} }
#[cfg(target_os = "macos")] #[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 /// Coordinates the naming of a the add-function-to-python-module function
fn function_wrapper_ident(name: &syn::Ident) -> syn::Ident { fn function_wrapper_ident(name: &syn::Ident) -> syn::Ident {
// Make sure this ident matches the one of wrap_function // 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( syn::Ident::new(
&format!( &format!(
"__pyo3_get_function_{}", "__pyo3_get_function_{}",
name.to_string().trim_left_matches("r#") name.to_string().trim_start_matches("r#")
), ),
Span::call_site(), Span::call_site(),
) )

View file

@ -148,7 +148,7 @@ pub fn pyfunction(
// Workaround for https://github.com/dtolnay/syn/issues/478 // Workaround for https://github.com/dtolnay/syn/issues/478
let python_name = syn::Ident::new( 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(), Span::call_site(),
); );
let expanded = module::add_fn_to_module(&mut ast, &python_name, Vec::new()); 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 commands
.trim_right() .trim_end()
.replace(&("\n".to_string() + &indent), "\n") .replace(&("\n".to_string() + &indent), "\n")
+ "\n" + "\n"
} }