diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-05-07 17:32:31 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-05-07 17:32:31 +0200 |
| commit | 390fc73ae737ef99fa109add85bbf60e53f1a983 (patch) | |
| tree | dcfda890a817f4405d112aa133f48a073e9929f9 | |
| parent | 0bdf0726cf77c95937aea1df408c9b18fe33f010 (diff) | |
| download | rust-390fc73ae737ef99fa109add85bbf60e53f1a983.tar.gz rust-390fc73ae737ef99fa109add85bbf60e53f1a983.zip | |
Fix new clippy lints
| -rw-r--r-- | src/consts.rs | 6 | ||||
| -rw-r--r-- | src/debuginfo.rs | 5 | ||||
| -rw-r--r-- | src/declare.rs | 1 | ||||
| -rw-r--r-- | tests/lang_tests_common.rs | 5 |
4 files changed, 7 insertions, 10 deletions
diff --git a/src/consts.rs b/src/consts.rs index 0a67bd7bc71..033afc0f8fb 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -191,13 +191,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { // TODO(antoyo): check if it's okay that no link_section is set. let typ = self.val_ty(cv).get_aligned(align.bytes()); - let global = self.declare_private_global(&name[..], typ); - global + self.declare_private_global(&name[..], typ) } _ => { let typ = self.val_ty(cv).get_aligned(align.bytes()); - let global = self.declare_unnamed_global(typ); - global + self.declare_unnamed_global(typ) } }; global.global_set_initializer_rvalue(cv); diff --git a/src/debuginfo.rs b/src/debuginfo.rs index f3ced864395..e0597d0030d 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -289,7 +289,7 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> { ) -> Self::DILocation { let pos = span.lo(); let DebugLoc { file, line, col } = self.lookup_debug_loc(pos); - let loc = match file.name { + match file.name { rustc_span::FileName::Real(ref name) => match *name { rustc_span::RealFileName::LocalPath(ref name) => { if let Some(name) = name.to_str() { @@ -314,7 +314,6 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } }, _ => Location::null(), - }; - loc + } } } diff --git a/src/declare.rs b/src/declare.rs index c1ca3eb849e..bed82073e2c 100644 --- a/src/declare.rs +++ b/src/declare.rs @@ -157,6 +157,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { /// /// If there’s a value with the same name already declared, the function will /// update the declaration and return existing Value instead. +#[allow(clippy::let_and_return)] fn declare_raw_fn<'gcc>( cx: &CodegenCx<'gcc, '_>, name: &str, diff --git a/tests/lang_tests_common.rs b/tests/lang_tests_common.rs index f0a9e72f2ea..bdcf14b4b26 100644 --- a/tests/lang_tests_common.rs +++ b/tests/lang_tests_common.rs @@ -69,15 +69,14 @@ pub fn main_inner(profile: Profile) { .test_dir("tests/run") .test_path_filter(filter) .test_extract(|path| { - let lines = std::fs::read_to_string(path) + std::fs::read_to_string(path) .expect("read file") .lines() .skip_while(|l| !l.starts_with("//")) .take_while(|l| l.starts_with("//")) .map(|l| &l[2..]) .collect::<Vec<_>>() - .join("\n"); - lines + .join("\n") }) .test_cmds(move |path| { // Test command 1: Compile `x.rs` into `tempdir/x`. |
