Submitter | Yuya Nishihara |
---|---|
Date | Nov. 19, 2019, 3:20 p.m. |
Message ID | <3a542e3823dda716ec47.1574176836@mimosa> |
Download | mbox | patch |
Permalink | /patch/43360/ |
State | Accepted |
Headers | show |
Comments
Nit: I prefer to nest the imports. I don't have any issue with the intent of this patch, namespacing might be clearer. On 11/19/19 4:20 PM, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1574172976 -32400 > # Tue Nov 19 23:16:16 2019 +0900 > # Node ID 3a542e3823dda716ec473bf5ef9f4c5b60e8a368 > # Parent 039fbd14d4e2889be830cc114957c31972c6ea04 > rust-cpython: import utils::files::* function at module level > > IIRC, it's common in Rust to call functions with the module prefix. > > diff --git a/rust/hg-cpython/src/filepatterns.rs b/rust/hg-cpython/src/filepatterns.rs > --- a/rust/hg-cpython/src/filepatterns.rs > +++ b/rust/hg-cpython/src/filepatterns.rs > @@ -15,10 +15,8 @@ use crate::exceptions::{PatternError, Pa > 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 @@ fn read_pattern_file_wrapper( > 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 { > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On Tue, Nov 19, 2019 at 6:31 PM Yuya Nishihara <yuya@tcha.org> wrote: > > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1574172976 -32400 > # Tue Nov 19 23:16:16 2019 +0900 > # Node ID 3a542e3823dda716ec473bf5ef9f4c5b60e8a368 > # Parent 039fbd14d4e2889be830cc114957c31972c6ea04 > rust-cpython: import utils::files::* function at module level > > IIRC, it's common in Rust to call functions with the module prefix. Queued the series, many thanks! > > diff --git a/rust/hg-cpython/src/filepatterns.rs b/rust/hg-cpython/src/filepatterns.rs > --- a/rust/hg-cpython/src/filepatterns.rs > +++ b/rust/hg-cpython/src/filepatterns.rs > @@ -15,10 +15,8 @@ use crate::exceptions::{PatternError, Pa > 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 @@ fn read_pattern_file_wrapper( > 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 { > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/rust/hg-cpython/src/filepatterns.rs b/rust/hg-cpython/src/filepatterns.rs --- a/rust/hg-cpython/src/filepatterns.rs +++ b/rust/hg-cpython/src/filepatterns.rs @@ -15,10 +15,8 @@ use crate::exceptions::{PatternError, Pa 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 @@ fn read_pattern_file_wrapper( 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 {