Skip to content

Commit

Permalink
fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
digizeph committed Aug 4, 2024
1 parent 0231b7f commit 8f69a69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
40 changes: 19 additions & 21 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,27 +171,25 @@ assert_eq!(lines[1].as_str(), "This is a test.");
#### Common IO operations
```rust,no_run
fn main() {
let to_read_file = "https://spaces.bgpkit.org/oneio/test_data.txt.gz";
let to_write_file = "/tmp/test_write.txt.bz2";
// read text from remote gzip file
let mut text = "".to_string();
oneio::get_reader(to_read_file).unwrap().read_to_string(&mut text).unwrap();
// write the same text to a local bz2 file
let mut writer = oneio::get_writer(to_write_file).unwrap();
writer.write_all(text.as_ref()).unwrap();
drop(writer);
// read from the newly generated bz2 file
let mut new_text = "".to_string();
oneio::get_reader(to_write_file).unwrap().read_to_string(&mut new_text).unwrap();
// compare the decompressed content of the remote and local files
assert_eq!(text.as_str(), new_text.as_str());
std::fs::remove_file(to_write_file).unwrap();
}
let to_read_file = "https://spaces.bgpkit.org/oneio/test_data.txt.gz";
let to_write_file = "/tmp/test_write.txt.bz2";
// read text from remote gzip file
let mut text = "".to_string();
oneio::get_reader(to_read_file).unwrap().read_to_string(&mut text).unwrap();
// write the same text to a local bz2 file
let mut writer = oneio::get_writer(to_write_file).unwrap();
writer.write_all(text.as_ref()).unwrap();
drop(writer);
// read from the newly generated bz2 file
let mut new_text = "".to_string();
oneio::get_reader(to_write_file).unwrap().read_to_string(&mut new_text).unwrap();
// compare the decompressed content of the remote and local files
assert_eq!(text.as_str(), new_text.as_str());
std::fs::remove_file(to_write_file).unwrap();
```
#### Read remote content with custom headers
Expand Down
7 changes: 2 additions & 5 deletions src/oneio/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ pub fn s3_url_parse(path: &str) -> Result<(String, String), OneIoError> {
/// This function can return a `OneIoError` if any of the following conditions occur:
///
/// * Failed to load the environment variables from the .env file.
/// * Failed to create a new `Bucket` object with the given `bucket` name, `Region`,
/// and `Credentials`.
/// * Failed to create a new `Bucket` object with the given `bucket` name, `Region`, and `Credentials`.
///
/// # Examples
///
Expand Down Expand Up @@ -398,9 +397,7 @@ pub fn s3_exists(bucket: &str, path: &str) -> Result<bool, OneIoError> {
///
/// # Returns
///
/// * If the URL does not start with "s3://".
/// Returns a `Result` with a `Vec<String>` containing the object keys on success,
/// or a `OneIoError` on failure.
/// * If the URL does not start with "s3://". Returns a `Result` with a `Vec<String>` containing the object keys on success, or a `OneIoError` on failure.
///
/// # Example
///
Expand Down

0 comments on commit 8f69a69

Please sign in to comment.