Skip to content
Snippets Groups Projects
Verified Commit 45f61975 authored by Vincent Lafeychine's avatar Vincent Lafeychine
Browse files

clippy: Fix let_unit_value

parent 04525fd6
No related branches found
No related tags found
1 merge request!47Fix most of `clippy::restriction` and `clippy::pedantic`
...@@ -101,9 +101,7 @@ rustflags = [ ...@@ -101,9 +101,7 @@ rustflags = [
"-Aclippy::min_ident_chars", "-Aclippy::min_ident_chars",
"-Aclippy::missing_inline_in_public_items", "-Aclippy::missing_inline_in_public_items",
"-Aclippy::missing_trait_methods", "-Aclippy::missing_trait_methods",
"-Aclippy::pub_with_shorthand", # ("pub_without_shortand" is allowed)
"-Aclippy::question_mark_used", "-Aclippy::question_mark_used",
"-Aclippy::semicolon_outside_block", # ("semicolon_outside_block" is allowed)
"-Aclippy::shadow_reuse", "-Aclippy::shadow_reuse",
"-Aclippy::shadow_same", "-Aclippy::shadow_same",
"-Aclippy::shadow_unrelated", "-Aclippy::shadow_unrelated",
...@@ -123,10 +121,10 @@ rustflags = [ ...@@ -123,10 +121,10 @@ rustflags = [
# `clippy::restriction` is enabled globally, but used carefully. # `clippy::restriction` is enabled globally, but used carefully.
"-Aclippy::blanket_clippy_restriction_lints", "-Aclippy::blanket_clippy_restriction_lints",
"-Aclippy::mod_module_files", # see: self_named_module_files
# These lints could be false positives, and should be caught by other lints. "-Aclippy::mod_module_files", # see: self_named_module_files
"-Aclippy::let_unit_value", "-Aclippy::pub_with_shorthand", # see: pub_without_shortand
"-Aclippy::semicolon_outside_block", # see: semicolon_inline_block
] ]
[unstable.gitoxide] [unstable.gitoxide]
......
...@@ -41,7 +41,6 @@ impl ConstAttrParser for VerboseConstAttrParser { ...@@ -41,7 +41,6 @@ impl ConstAttrParser for VerboseConstAttrParser {
_did: LocalDefId, _did: LocalDefId,
attrs: &'a [&'a AttrItem], attrs: &'a [&'a AttrItem],
) -> Result<ConstAttrs, String> { ) -> Result<ConstAttrs, String> {
let meta = ();
let mut name: Option<String> = None; let mut name: Option<String> = None;
for &it in attrs { for &it in attrs {
...@@ -56,7 +55,7 @@ impl ConstAttrParser for VerboseConstAttrParser { ...@@ -56,7 +55,7 @@ impl ConstAttrParser for VerboseConstAttrParser {
match seg.ident.name.as_str() { match seg.ident.name.as_str() {
"name" => { "name" => {
let parsed_name: parse::LitStr = buffer.parse(&meta).map_err(str_err)?; let parsed_name: parse::LitStr = buffer.parse(&()).map_err(str_err)?;
if name.is_some() { if name.is_some() {
return Err(format!("name attribute has already been specified")); return Err(format!("name attribute has already been specified"));
} }
......
...@@ -37,7 +37,6 @@ impl VerboseCrateAttrParser { ...@@ -37,7 +37,6 @@ impl VerboseCrateAttrParser {
impl CrateAttrParser for VerboseCrateAttrParser { impl CrateAttrParser for VerboseCrateAttrParser {
fn parse_crate_attrs<'a>(&'a mut self, attrs: &'a [&'a AttrItem]) -> Result<CrateAttrs, String> { fn parse_crate_attrs<'a>(&'a mut self, attrs: &'a [&'a AttrItem]) -> Result<CrateAttrs, String> {
let meta = ();
let mut exports: Vec<coq::Export> = Vec::new(); let mut exports: Vec<coq::Export> = Vec::new();
let mut includes: Vec<String> = Vec::new(); let mut includes: Vec<String> = Vec::new();
let mut prefix: Option<String> = None; let mut prefix: Option<String> = None;
...@@ -55,29 +54,29 @@ impl CrateAttrParser for VerboseCrateAttrParser { ...@@ -55,29 +54,29 @@ impl CrateAttrParser for VerboseCrateAttrParser {
let buffer = parse::Buffer::new(&it.args.inner_tokens()); let buffer = parse::Buffer::new(&it.args.inner_tokens());
match seg.ident.name.as_str() { match seg.ident.name.as_str() {
"import" => { "import" => {
let path: parse_utils::CoqModule = buffer.parse(&meta).map_err(str_err)?; let path: parse_utils::CoqModule = buffer.parse(&()).map_err(str_err)?;
exports.push(coq::Export::new(path.into())); exports.push(coq::Export::new(path.into()));
}, },
"include" => { "include" => {
let name: parse::LitStr = buffer.parse(&meta).map_err(str_err)?; let name: parse::LitStr = buffer.parse(&()).map_err(str_err)?;
includes.push(name.value()); includes.push(name.value());
}, },
"coq_prefix" => { "coq_prefix" => {
let path: parse::LitStr = buffer.parse(&meta).map_err(str_err)?; let path: parse::LitStr = buffer.parse(&()).map_err(str_err)?;
if prefix.is_some() { if prefix.is_some() {
return Err(format!("multiple rr::coq_prefix attributes have been provided")); return Err(format!("multiple rr::coq_prefix attributes have been provided"));
} }
prefix = Some(path.value().clone()); prefix = Some(path.value().clone());
}, },
"package" => { "package" => {
let path: parse::LitStr = buffer.parse(&meta).map_err(str_err)?; let path: parse::LitStr = buffer.parse(&()).map_err(str_err)?;
if package.is_some() { if package.is_some() {
return Err(format!("multiple rr::package attributes have been provided")); return Err(format!("multiple rr::package attributes have been provided"));
} }
package = Some(path.value().clone()); package = Some(path.value().clone());
}, },
"context" => { "context" => {
let param: parse_utils::RRGlobalCoqContextItem = buffer.parse(&meta).map_err(str_err)?; let param: parse_utils::RRGlobalCoqContextItem = buffer.parse(&()).map_err(str_err)?;
context_params.push(coq::Param::new( context_params.push(coq::Param::new(
coq::Name::Unnamed, coq::Name::Unnamed,
coq::Type::Literal(param.item), coq::Type::Literal(param.item),
......
...@@ -25,9 +25,6 @@ impl<F> parse::Parse<F> for RustPath { ...@@ -25,9 +25,6 @@ impl<F> parse::Parse<F> for RustPath {
} }
pub fn get_export_as_attr(attrs: &[&AttrItem]) -> Result<Vec<String>, String> { pub fn get_export_as_attr(attrs: &[&AttrItem]) -> Result<Vec<String>, String> {
let meta: () = ();
let meta = &meta;
for &it in attrs { for &it in attrs {
let path_segs = &it.path.segments; let path_segs = &it.path.segments;
...@@ -35,7 +32,7 @@ pub fn get_export_as_attr(attrs: &[&AttrItem]) -> Result<Vec<String>, String> { ...@@ -35,7 +32,7 @@ pub fn get_export_as_attr(attrs: &[&AttrItem]) -> Result<Vec<String>, String> {
let buffer = parse::Buffer::new(&it.args.inner_tokens()); let buffer = parse::Buffer::new(&it.args.inner_tokens());
if seg.ident.name.as_str() == "export_as" { if seg.ident.name.as_str() == "export_as" {
let path = RustPath::parse(&buffer, meta).map_err(parse_utils::str_err)?; let path = RustPath::parse(&buffer, &()).map_err(parse_utils::str_err)?;
return Ok(path.path); return Ok(path.path);
} }
} }
...@@ -74,9 +71,6 @@ where ...@@ -74,9 +71,6 @@ where
/// Extract a shim annotation from a list of annotations of a function or method. /// Extract a shim annotation from a list of annotations of a function or method.
pub fn get_shim_attrs(attrs: &[&AttrItem]) -> Result<ShimAnnot, String> { pub fn get_shim_attrs(attrs: &[&AttrItem]) -> Result<ShimAnnot, String> {
let meta: () = ();
let meta = &meta;
for &it in attrs { for &it in attrs {
let path_segs = &it.path.segments; let path_segs = &it.path.segments;
...@@ -84,7 +78,7 @@ pub fn get_shim_attrs(attrs: &[&AttrItem]) -> Result<ShimAnnot, String> { ...@@ -84,7 +78,7 @@ pub fn get_shim_attrs(attrs: &[&AttrItem]) -> Result<ShimAnnot, String> {
let buffer = parse::Buffer::new(&it.args.inner_tokens()); let buffer = parse::Buffer::new(&it.args.inner_tokens());
if seg.ident.name.as_str() == "shim" { if seg.ident.name.as_str() == "shim" {
let annot = ShimAnnot::parse(&buffer, meta).map_err(parse_utils::str_err)?; let annot = ShimAnnot::parse(&buffer, &()).map_err(parse_utils::str_err)?;
return Ok(annot); return Ok(annot);
} }
} }
......
...@@ -44,7 +44,6 @@ impl ModuleAttrParser for VerboseModuleAttrParser { ...@@ -44,7 +44,6 @@ impl ModuleAttrParser for VerboseModuleAttrParser {
_did: LocalDefId, _did: LocalDefId,
attrs: &'a [&'a AttrItem], attrs: &'a [&'a AttrItem],
) -> Result<ModuleAttrs, String> { ) -> Result<ModuleAttrs, String> {
let meta = ();
let mut exports: Vec<coq::Export> = Vec::new(); let mut exports: Vec<coq::Export> = Vec::new();
let mut includes: Vec<String> = Vec::new(); let mut includes: Vec<String> = Vec::new();
let mut context_params = Vec::new(); let mut context_params = Vec::new();
...@@ -60,15 +59,15 @@ impl ModuleAttrParser for VerboseModuleAttrParser { ...@@ -60,15 +59,15 @@ impl ModuleAttrParser for VerboseModuleAttrParser {
let buffer = parse::Buffer::new(&it.args.inner_tokens()); let buffer = parse::Buffer::new(&it.args.inner_tokens());
match seg.ident.name.as_str() { match seg.ident.name.as_str() {
"import" => { "import" => {
let path: parse_utils::CoqModule = buffer.parse(&meta).map_err(str_err)?; let path: parse_utils::CoqModule = buffer.parse(&()).map_err(str_err)?;
exports.push(coq::Export::new(path.into())); exports.push(coq::Export::new(path.into()));
}, },
"include" => { "include" => {
let name: parse::LitStr = buffer.parse(&meta).map_err(str_err)?; let name: parse::LitStr = buffer.parse(&()).map_err(str_err)?;
includes.push(name.value()); includes.push(name.value());
}, },
"context" => { "context" => {
let param: parse_utils::RRGlobalCoqContextItem = buffer.parse(&meta).map_err(str_err)?; let param: parse_utils::RRGlobalCoqContextItem = buffer.parse(&()).map_err(str_err)?;
context_params.push(coq::Param::new( context_params.push(coq::Param::new(
coq::Name::Unnamed, coq::Name::Unnamed,
coq::Type::Literal(param.item), coq::Type::Literal(param.item),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment