Patchwork [4,of,5,STABLE] rust-cpython: import utils::files::* function at module level

login
register
mail settings
Submitter Raphaël Gomès
Date Dec. 12, 2019, 4:46 p.m.
Message ID <c549f8598cdf726b2e42.1576169188@alphare-carbon.lan>
Download mbox | patch
Permalink /patch/43747/
State New
Headers show

Comments

Raphaël Gomès - Dec. 12, 2019, 4:46 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1574172976 -32400
#      Tue Nov 19 23:16:16 2019 +0900
# Branch stable
# Node ID c549f8598cdf726b2e4239db5728ceebec448c23
# Parent  2f084275a6435092058eaf9cb1a46cc6d7b0821a
rust-cpython: import utils::files::* function at module level

IIRC, it's common in Rust to call functions with the module prefix.

Patch

diff -r 2f084275a643 -r c549f8598cdf rust/hg-cpython/src/filepatterns.rs
--- a/rust/hg-cpython/src/filepatterns.rs	Mon Nov 18 17:37:59 2019 +0100
+++ b/rust/hg-cpython/src/filepatterns.rs	Tue Nov 19 23:16:16 2019 +0900
@@ -15,10 +15,8 @@ 
 use cpython::{
     PyBytes, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, ToPyObject,
 };
-use hg::{
-    build_single_regex, read_pattern_file, utils::files::get_path_from_bytes,
-    LineNumber, PatternTuple,
-};
+use hg::utils::files;
+use hg::{build_single_regex, read_pattern_file, LineNumber, PatternTuple};
 use std::path::PathBuf;
 
 /// Rust does not like functions with different return signatures.
@@ -38,7 +36,7 @@ 
     source_info: bool,
 ) -> PyResult<PyTuple> {
     let bytes = file_path.extract::<PyBytes>(py)?;
-    let path = get_path_from_bytes(bytes.data(py));
+    let path = files::get_path_from_bytes(bytes.data(py));
     match read_pattern_file(path, warn) {
         Ok((patterns, warnings)) => {
             if source_info {