From 77cfe3bbc4af746da8ad7520d8e167a88d132250 Mon Sep 17 00:00:00 2001 From: Tim Van Wassenhove Date: Tue, 26 Mar 2024 22:40:03 +0100 Subject: [PATCH] lint: disable warn on unused code --- src/args.rs | 11 +++++++++-- src/globbing_path.rs | 18 ++++++++++-------- src/main.rs | 4 ++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/args.rs b/src/args.rs index 3626829..0524b41 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,4 +1,4 @@ -use crate::GlobbingPath; +//use crate::GlobbingPath; use aws_sdk_glue::Client; use aws_types::SdkConfig; use chrono::{DateTime, Utc}; @@ -50,6 +50,7 @@ impl Args { query } + /* pub async fn get_globbing_path(&self) -> Result { let (data_location, maybe_sdk_config) = match update_s3_console_url(&self.path) { (true, updated_location) => (updated_location, Some(get_sdk_config(self).await)), @@ -79,9 +80,10 @@ impl Args { let globbing_path = GlobbingPath::parse(&data_location)?; Ok(globbing_path) - } + }*/ } +#[allow(dead_code)] async fn get_sdk_config(args: &Args) -> SdkConfig { set_aws_profile_when_needed(args); set_aws_region_when_needed(); @@ -89,12 +91,14 @@ async fn get_sdk_config(args: &Args) -> SdkConfig { aws_config::load_from_env().await } +#[allow(dead_code)] fn set_aws_profile_when_needed(args: &Args) { if let Some(aws_profile) = &args.profile { env::set_var("AWS_PROFILE", aws_profile); } } +#[allow(dead_code)] fn set_aws_region_when_needed() { match env::var("AWS_DEFAULT_REGION") { Ok(_) => {} @@ -102,6 +106,7 @@ fn set_aws_region_when_needed() { } } +#[allow(dead_code)] async fn get_storage_location( sdk_config: &SdkConfig, database_name: &str, @@ -140,6 +145,7 @@ async fn get_storage_location( Ok(location.to_string()) } +#[allow(dead_code)] fn parse_glue_url(s: &str) -> Option<(String, String)> { let re: Regex = Regex::new(r"^glue://(\w+)\.(\w+)$").unwrap(); re.captures(s).map(|captures| { @@ -160,6 +166,7 @@ fn test_parse_glue_url() { /// When the provided s looks like an https url from the amazon webui convert it to an s3:// url /// When the provided s does not like such url, return it as is. +#[allow(dead_code)] fn update_s3_console_url(s: &str) -> (bool, String) { if s.starts_with("https://s3.console.aws.amazon.com/s3/buckets/") { let parsed_url = Url::parse(s).unwrap_or_else(|_| panic!("Failed to parse {}", s)); diff --git a/src/globbing_path.rs b/src/globbing_path.rs index d291850..a19f5ac 100644 --- a/src/globbing_path.rs +++ b/src/globbing_path.rs @@ -1,3 +1,4 @@ +/* use datafusion::common::{DataFusionError, Result}; use datafusion::datasource::listing::ListingTableUrl; use datafusion::datasource::object_store::ObjectStoreUrl; @@ -171,10 +172,10 @@ fn test_extract_path_parts() { assert_eq!("a", actual.1.as_ref()); assert_eq!(Some(Pattern::new("a/b*").unwrap()), actual.2); - let actual = extract_path_parts("s3://bucket/a/b*/c").unwrap(); - assert_eq!("s3://bucket/", actual.0.as_str()); - assert_eq!("a", actual.1.as_ref()); - assert_eq!(Some(Pattern::new("a/b*/c").unwrap()), actual.2); + // let actual = extract_path_parts("s3://bucket/a/b* /c").unwrap(); + // assert_eq!("s3://bucket/", actual.0.as_str()); + // assert_eq!("a", actual.1.as_ref()); + // assert_eq!(Some(Pattern::new("a/b* /c").unwrap()), actual.2); let actual = extract_path_parts("file://").unwrap(); assert_eq!("file:///", actual.0.as_str()); @@ -201,10 +202,10 @@ fn test_extract_path_parts() { assert_eq!("", actual.1.as_ref()); assert_eq!(Some(Pattern::new("c*").unwrap()), actual.2); - let actual = extract_path_parts("file:///a/b*/c").unwrap(); - assert_eq!("file:///", actual.0.as_str()); - assert_eq!("a", actual.1.as_ref()); - assert_eq!(Some(Pattern::new("a/b*/c").unwrap()), actual.2); + // let actual = extract_path_parts("file:///a/b* /c").unwrap(); + // assert_eq!("file:///", actual.0.as_str()); + // assert_eq!("a", actual.1.as_ref()); + // assert_eq!(Some(Pattern::new("a/b* /c").unwrap()), actual.2); } /// Splits `path` at the first path segment containing a glob expression, returning @@ -232,3 +233,4 @@ fn split_glob_expression(path: &str) -> Option<(&str, &str)> { } None } +*/ \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 609bcb0..d0e5411 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use datafusion::common::Result; use datafusion::datasource::listing::{ - ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl, + ListingTable, ListingTableConfig, ListingTableUrl, }; use datafusion::prelude::*; @@ -15,7 +15,7 @@ mod globbing_table; mod object_store_util; use crate::args::Args; -use crate::globbing_path::GlobbingPath; +//use crate::globbing_path::GlobbingPath; //use crate::globbing_table::build_table_provider; //use crate::object_store_util::register_object_store;