-
-
Notifications
You must be signed in to change notification settings - Fork 159
Run clippy and fmt #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run clippy and fmt #471
Changes from all commits
0f8a88c
6efb933
3f535f2
afe3f1d
9a64602
0e56f38
431d267
3a1ad26
b0f7bc3
7950006
844eaec
90c42a2
700cc8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ target | |
| .vscode/settings.json | ||
| .cargo/config.toml | ||
| yarn-error.log | ||
| /.idea | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,7 @@ impl<E: Environment> SchemaAssociations<E> { | |
| self.retain(|(_, assoc)| assoc.meta["source"] != source::BUILTIN); | ||
|
|
||
| self.associations.write().push(( | ||
| AssociationRule::Regex(Regex::new(r#".*\.?taplo\.toml$"#).unwrap()), | ||
| AssociationRule::Regex(Regex::new(r".*\.?taplo\.toml$").unwrap()), | ||
| SchemaAssociation { | ||
| url: builtins::TAPLO_CONFIG_URL.parse().unwrap(), | ||
| meta: json!({ | ||
|
|
@@ -193,7 +193,7 @@ impl<E: Environment> SchemaAssociations<E> { | |
| tracing::debug!(%error, "invalid url in directive, assuming file path instead"); | ||
|
|
||
| if self.env.is_absolute(Path::new(value)) { | ||
| match format!("file://{}", value).parse() { | ||
| match format!("file://{value}").parse() { | ||
| Ok(u) => u, | ||
| Err(error) => { | ||
| tracing::error!(%error, "invalid schema directive"); | ||
|
|
@@ -256,9 +256,8 @@ impl<E: Environment> SchemaAssociations<E> { | |
|
|
||
| pub fn add_from_config(&self, config: &Config) { | ||
| for rule in &config.rule { | ||
| let file_rule = match rule.file_rule.clone() { | ||
| Some(rule) => rule, | ||
| None => continue, | ||
| let Some(file_rule) = rule.file_rule.clone() else { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit afraid this forces recent compiler version (and slightly a "breaking" change regarding MSRV). Does clippy really suggests to do this?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm yeah, this let-else was stabilised in 1.65 rust which would be breaking for old versions. |
||
| continue; | ||
| }; | ||
|
|
||
| if let Some(schema_opts) = &rule.options.schema { | ||
|
|
@@ -279,9 +278,8 @@ impl<E: Environment> SchemaAssociations<E> { | |
| } | ||
| } | ||
|
|
||
| let file_rule = match config.file_rule.clone() { | ||
| Some(rule) => rule, | ||
| None => return, | ||
| let Some(file_rule) = config.file_rule.clone() else { | ||
| return; | ||
| }; | ||
|
|
||
| if let Some(schema_opts) = &config.global_options.schema { | ||
|
|
@@ -392,7 +390,7 @@ pub enum AssociationRule { | |
|
|
||
| impl AssociationRule { | ||
| pub fn glob(pattern: &str) -> Result<Self, anyhow::Error> { | ||
| Ok(Self::Glob(GlobRule::new(&[pattern], &[] as &[&str])?)) | ||
| Ok(Self::Glob(GlobRule::new([pattern], &[] as &[&str])?)) | ||
| } | ||
|
|
||
| pub fn regex(regex: &str) -> Result<Self, anyhow::Error> { | ||
|
|
@@ -520,8 +518,7 @@ impl<'de> Deserialize<'de> for SchemaStoreCatalogSchema { | |
|
|
||
| if s != SCHEMA_STORE_CATALOG_SCHEMA_URL { | ||
| return Err(Error::custom(format!( | ||
| "expected $schema to be {}", | ||
| SCHEMA_STORE_CATALOG_SCHEMA_URL | ||
| "expected $schema to be {SCHEMA_STORE_CATALOG_SCHEMA_URL}" | ||
| ))); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.