Merge commit '4f142aa1058f14f153f8bfd2d82f04ddb9982388' into clippyup
This commit is contained in:
@@ -49,7 +49,7 @@ fn mtime(path: impl AsRef<Path>) -> SystemTime {
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.flatten()
|
||||
.map(|entry| mtime(&entry.path()))
|
||||
.map(|entry| mtime(entry.path()))
|
||||
.max()
|
||||
.unwrap_or(SystemTime::UNIX_EPOCH)
|
||||
} else {
|
||||
|
||||
@@ -36,9 +36,8 @@ impl ClippyProjectInfo {
|
||||
}
|
||||
|
||||
pub fn setup_rustc_src(rustc_path: &str) {
|
||||
let rustc_source_dir = match check_and_get_rustc_dir(rustc_path) {
|
||||
Ok(path) => path,
|
||||
Err(_) => return,
|
||||
let Ok(rustc_source_dir) = check_and_get_rustc_dir(rustc_path) else {
|
||||
return
|
||||
};
|
||||
|
||||
for project in CLIPPY_PROJECTS {
|
||||
@@ -172,14 +171,10 @@ pub fn remove_rustc_src() {
|
||||
}
|
||||
|
||||
fn remove_rustc_src_from_project(project: &ClippyProjectInfo) -> bool {
|
||||
let mut cargo_content = if let Ok(content) = read_project_file(project.cargo_file) {
|
||||
content
|
||||
} else {
|
||||
let Ok(mut cargo_content) = read_project_file(project.cargo_file) else {
|
||||
return false;
|
||||
};
|
||||
let section_start = if let Some(section_start) = cargo_content.find(RUSTC_PATH_SECTION) {
|
||||
section_start
|
||||
} else {
|
||||
let Some(section_start) = cargo_content.find(RUSTC_PATH_SECTION) else {
|
||||
println!(
|
||||
"info: dependencies could not be found in `{}` for {}, skipping file",
|
||||
project.cargo_file, project.name
|
||||
@@ -187,9 +182,7 @@ fn remove_rustc_src_from_project(project: &ClippyProjectInfo) -> bool {
|
||||
return true;
|
||||
};
|
||||
|
||||
let end_point = if let Some(end_point) = cargo_content.find(DEPENDENCIES_SECTION) {
|
||||
end_point
|
||||
} else {
|
||||
let Some(end_point) = cargo_content.find(DEPENDENCIES_SECTION) else {
|
||||
eprintln!(
|
||||
"error: the end of the rustc dependencies section could not be found in `{}`",
|
||||
project.cargo_file
|
||||
|
||||
@@ -128,7 +128,7 @@ fn generate_lint_files(
|
||||
for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter().chain(internal_lints)) {
|
||||
let content = gen_lint_group_list(&lint_group, lints.iter());
|
||||
process_file(
|
||||
&format!("clippy_lints/src/lib.register_{lint_group}.rs"),
|
||||
format!("clippy_lints/src/lib.register_{lint_group}.rs"),
|
||||
update_mode,
|
||||
&content,
|
||||
);
|
||||
@@ -869,13 +869,11 @@ fn clippy_lints_src_files() -> impl Iterator<Item = (PathBuf, DirEntry)> {
|
||||
macro_rules! match_tokens {
|
||||
($iter:ident, $($token:ident $({$($fields:tt)*})? $(($capture:ident))?)*) => {
|
||||
{
|
||||
$($(let $capture =)? if let Some(LintDeclSearchResult {
|
||||
$(#[allow(clippy::redundant_pattern)] let Some(LintDeclSearchResult {
|
||||
token_kind: TokenKind::$token $({$($fields)*})?,
|
||||
content: _x,
|
||||
content: $($capture @)? _,
|
||||
..
|
||||
}) = $iter.next() {
|
||||
_x
|
||||
} else {
|
||||
}) = $iter.next() else {
|
||||
continue;
|
||||
};)*
|
||||
#[allow(clippy::unused_unit)]
|
||||
|
||||
Reference in New Issue
Block a user