repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/src/serde_impls.rs
src/tools/rust-analyzer/lib/text-size/src/serde_impls.rs
use { crate::{TextRange, TextSize}, serde::{Deserialize, Deserializer, Serialize, Serializer, de}, }; impl Serialize for TextSize { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { self.raw.serialize(serializer) } } impl<'de> Deserialize<'...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/src/size.rs
src/tools/rust-analyzer/lib/text-size/src/size.rs
use { crate::TextLen, std::{ convert::TryFrom, fmt, iter, num::TryFromIntError, ops::{Add, AddAssign, Sub, SubAssign}, }, }; /// A measure of text length. Also, equivalently, an index into text. /// /// This is a UTF-8 bytes offset stored as `u32`, but /// most clients shoul...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/tests/constructors.rs
src/tools/rust-analyzer/lib/text-size/tests/constructors.rs
use text_size::TextSize; #[derive(Copy, Clone)] struct BadRope<'a>(&'a [&'a str]); impl BadRope<'_> { fn text_len(self) -> TextSize { self.0.iter().copied().map(TextSize::of).sum() } } #[test] fn main() { let x: char = 'c'; let _ = TextSize::of(x); let x: &str = "hello"; let _ = Text...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/tests/serde.rs
src/tools/rust-analyzer/lib/text-size/tests/serde.rs
use {serde_test::*, std::ops, text_size::*}; fn size(x: u32) -> TextSize { TextSize::from(x) } fn range(x: ops::Range<u32>) -> TextRange { TextRange::new(x.start.into(), x.end.into()) } #[test] fn size_serialization() { assert_tokens(&size(00), &[Token::U32(00)]); assert_tokens(&size(10), &[Token::U3...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/tests/main.rs
src/tools/rust-analyzer/lib/text-size/tests/main.rs
use {std::ops, text_size::*}; fn size(x: u32) -> TextSize { TextSize::from(x) } fn range(x: ops::Range<u32>) -> TextRange { TextRange::new(x.start.into(), x.end.into()) } #[test] fn sum() { let xs: Vec<TextSize> = vec![size(0), size(1), size(2)]; assert_eq!(xs.iter().sum::<TextSize>(), size(3)); ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/tests/indexing.rs
src/tools/rust-analyzer/lib/text-size/tests/indexing.rs
use text_size::*; #[test] fn main() { let range = TextRange::default(); _ = &""[range]; _ = &String::new()[range]; }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/text-size/tests/auto_traits.rs
src/tools/rust-analyzer/lib/text-size/tests/auto_traits.rs
use { static_assertions::*, std::{ fmt::Debug, hash::Hash, marker::{Send, Sync}, panic::{RefUnwindSafe, UnwindSafe}, }, text_size::*, }; // auto traits assert_impl_all!(TextSize: Send, Sync, Unpin, UnwindSafe, RefUnwindSafe); assert_impl_all!(TextRange: Send, Sync, Unpin...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/line-index/src/lib.rs
src/tools/rust-analyzer/lib/line-index/src/lib.rs
//! See [`LineIndex`]. #![deny(missing_debug_implementations, missing_docs, rust_2018_idioms)] #[cfg(test)] mod tests; use nohash_hasher::IntMap; pub use text_size::{TextRange, TextSize}; /// `(line, column)` information in the native, UTF-8 encoding. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct L...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/line-index/src/tests.rs
src/tools/rust-analyzer/lib/line-index/src/tests.rs
use crate::{LineCol, LineIndex, TextSize, WideChar, WideEncoding, WideLineCol}; macro_rules! test { ( case: $test_name:ident, text: $text:expr, lines: $lines:expr, multi_byte_chars: $multi_byte_chars:expr, ) => { #[test] fn $test_name() { let line_index = Line...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/ungrammar/src/lexer.rs
src/tools/rust-analyzer/lib/ungrammar/src/lexer.rs
//! Simple hand-written ungrammar lexer use crate::error::{Result, bail}; #[derive(Debug, Eq, PartialEq)] pub(crate) enum TokenKind { Node(String), Token(String), Eq, Star, Pipe, QMark, Colon, LParen, RParen, } #[derive(Debug)] pub(crate) struct Token { pub(crate) kind: TokenKi...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/ungrammar/src/lib.rs
src/tools/rust-analyzer/lib/ungrammar/src/lib.rs
//! Ungrammar -- a DSL for specifying concrete syntax tree grammar. //! //! Producing a parser is an explicit non-goal -- it's ok for this grammar to be //! ambiguous, non LL, non LR, etc. //! //! See this //! [introductory post](https://rust-analyzer.github.io/blog/2020/10/24/introducing-ungrammar.html) //! for detail...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/ungrammar/src/parser.rs
src/tools/rust-analyzer/lib/ungrammar/src/parser.rs
//! Simple hand-written ungrammar parser. #![allow(clippy::disallowed_types)] use std::collections::HashMap; use crate::{ Grammar, Node, NodeData, Rule, Token, TokenData, error::{Result, format_err}, lexer::{self, TokenKind}, }; macro_rules! bail { ($loc:expr, $($tt:tt)*) => {{ let err = $crat...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/ungrammar/src/error.rs
src/tools/rust-analyzer/lib/ungrammar/src/error.rs
//! Boilerplate error definitions. use std::fmt; use crate::lexer::Location; /// A type alias for std's Result with the Error as our error type. pub type Result<T, E = Error> = std::result::Result<T, E>; /// An error encountered when parsing a Grammar. #[derive(Debug)] pub struct Error { pub(crate) message: Stri...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/ungrammar/ungrammar2json/src/main.rs
src/tools/rust-analyzer/lib/ungrammar/ungrammar2json/src/main.rs
#![allow(clippy::print_stderr, clippy::print_stdout)] use std::{ env, io::{self, Read}, process, }; use ungrammar::{Grammar, Rule}; fn main() { if let Err(err) = try_main() { eprintln!("{}", err); process::exit(101); } } fn try_main() -> io::Result<()> { if env::args().count()...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/la-arena/src/lib.rs
src/tools/rust-analyzer/lib/la-arena/src/lib.rs
//! Yet another index-based arena. #![warn(rust_2018_idioms, unused_lifetimes)] #![warn(missing_docs)] use std::{ cmp, fmt, hash::{Hash, Hasher}, iter::{Enumerate, FusedIterator}, marker::PhantomData, ops::{Index, IndexMut, Range, RangeInclusive}, }; mod map; pub use map::{ArenaMap, Entry, Occupi...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/la-arena/src/map.rs
src/tools/rust-analyzer/lib/la-arena/src/map.rs
use std::iter::Enumerate; use std::marker::PhantomData; use crate::Idx; /// A map from arena indexes to some other type. /// Space requirement is O(highest index). #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ArenaMap<IDX, V> { v: Vec<Option<V>>, _ty: PhantomData<IDX>, } impl<T, V...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/lib.rs
src/tools/rust-analyzer/lib/lsp-server/src/lib.rs
//! A language server scaffold, exposing a synchronous crossbeam-channel based API. //! This crate handles protocol handshaking and parsing messages, while you //! control the message dispatch loop yourself. //! //! Run with `RUST_LOG=lsp_server=debug` to see all the messages. #![warn(rust_2018_idioms, unused_lifetime...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs
src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs
use std::{ io::{self, stdin, stdout}, thread, }; use log::debug; use crossbeam_channel::{Receiver, Sender, bounded}; use crate::Message; /// Creates an LSP connection via stdio. pub(crate) fn stdio_transport() -> (Sender<Message>, Receiver<Message>, IoThreads) { let (drop_sender, drop_receiver) = bounde...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/req_queue.rs
src/tools/rust-analyzer/lib/lsp-server/src/req_queue.rs
use std::collections::HashMap; use crate::{ErrorCode, Request, RequestId, Response, ResponseError}; /// Manages the set of pending requests, both incoming and outgoing. #[derive(Debug)] pub struct ReqQueue<I, O> { pub incoming: Incoming<I>, pub outgoing: Outgoing<O>, } impl<I, O> Default for ReqQueue<I, O> {...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/error.rs
src/tools/rust-analyzer/lib/lsp-server/src/error.rs
use std::fmt; use crate::{Notification, Request}; #[derive(Debug, Clone, PartialEq)] pub struct ProtocolError(String, bool); impl ProtocolError { pub(crate) fn new(msg: impl Into<String>) -> Self { ProtocolError(msg.into(), false) } pub(crate) fn disconnected() -> ProtocolError { Protoco...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/msg.rs
src/tools/rust-analyzer/lib/lsp-server/src/msg.rs
use std::{ fmt, io::{self, BufRead, Write}, }; use serde::de::DeserializeOwned; use serde_derive::{Deserialize, Serialize}; use crate::error::ExtractError; #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(untagged)] pub enum Message { Request(Request), Response(Response), Notification(Noti...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/src/socket.rs
src/tools/rust-analyzer/lib/lsp-server/src/socket.rs
use std::{ io::{self, BufReader}, net::TcpStream, thread, }; use crossbeam_channel::{Receiver, Sender, bounded}; use crate::{ Message, stdio::{IoThreads, make_io_threads}, }; pub(crate) fn socket_transport( stream: TcpStream, ) -> (Sender<Message>, Receiver<Message>, IoThreads) { let (rea...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rust-analyzer/lib/lsp-server/examples/minimal_lsp.rs
src/tools/rust-analyzer/lib/lsp-server/examples/minimal_lsp.rs
//! Minimal Language‑Server‑Protocol example: **`minimal_lsp.rs`** //! ============================================================= //! //! | ↔ / ← | LSP method | What the implementation does | //! |-------|------------|------------------------------| //! | ↔ | `initialize` / `initialized` | capability handshake | //!...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/build.rs
src/tools/clippy/build.rs
fn main() { // Forward the profile to the main compilation println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap()); // Don't rebuild even if nothing changed println!("cargo:rerun-if-changed=build.rs"); rustc_tools_util::setup_version_info!(); }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dummy/build.rs
src/tools/clippy/clippy_dummy/build.rs
use term::color::{GREEN, RED, WHITE}; use term::{Attr, Error, Result}; fn main() { if foo().is_err() { eprintln!( "error: Clippy is no longer available via crates.io\n\n\ help: please run `rustup component add clippy` instead" ); } std::process::exit(1); } fn foo()...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dummy/src/main.rs
src/tools/clippy/clippy_dummy/src/main.rs
fn main() { panic!("This shouldn't even compile") }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/serve.rs
src/tools/clippy/clippy_dev/src/serve.rs
use crate::utils::{ErrAction, cargo_cmd, expect_action}; use core::fmt::Display; use core::mem; use std::path::Path; use std::process::Command; use std::time::{Duration, SystemTime}; use std::{fs, thread}; use walkdir::WalkDir; #[cfg(windows)] const PYTHON: &str = "python"; #[cfg(not(windows))] const PYTHON: &str = "...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/dogfood.rs
src/tools/clippy/clippy_dev/src/dogfood.rs
use crate::utils::{cargo_cmd, run_exit_on_err}; use itertools::Itertools; /// # Panics /// /// Panics if unable to run the dogfood test #[expect(clippy::fn_params_excessive_bools)] pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool, allow_no_vcs: bool) { run_exit_on_err( "cargo test", ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/new_lint.rs
src/tools/clippy/clippy_dev/src/new_lint.rs
use crate::parse::cursor::{self, Capture, Cursor}; use crate::utils::Version; use clap::ValueEnum; use indoc::{formatdoc, writedoc}; use std::fmt::{self, Write as _}; use std::fs::{self, OpenOptions}; use std::io::{self, Write as _}; use std::path::{Path, PathBuf}; #[derive(Clone, Copy, PartialEq, ValueEnum)] pub enum...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/lib.rs
src/tools/clippy/clippy_dev/src/lib.rs
#![feature( exit_status_error, if_let_guard, new_range, new_range_api, os_str_slice, os_string_truncate, pattern, rustc_private, slice_split_once )] #![warn( trivial_casts, trivial_numeric_casts, rust_2018_idioms, unused_lifetimes, unused_qualifications )] #![allo...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/parse.rs
src/tools/clippy/clippy_dev/src/parse.rs
pub mod cursor; use self::cursor::{Capture, Cursor}; use crate::utils::{ErrAction, File, Scoped, expect_action, walk_dir_no_dot_or_target}; use core::fmt::{Display, Write as _}; use core::range::Range; use rustc_arena::DroplessArena; use std::fs; use std::path::{self, Path, PathBuf}; use std::str::pattern::Pattern; p...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/update_lints.rs
src/tools/clippy/clippy_dev/src/update_lints.rs
use crate::parse::cursor::Cursor; use crate::parse::{DeprecatedLint, Lint, ParseCx, RenamedLint}; use crate::utils::{FileUpdater, UpdateMode, UpdateStatus, update_text_region_fn}; use itertools::Itertools; use std::collections::HashSet; use std::fmt::Write; use std::path::{self, Path}; const GENERATED_FILE_COMMENT: &s...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/sync.rs
src/tools/clippy/clippy_dev/src/sync.rs
use crate::utils::{FileUpdater, update_text_region_fn}; use chrono::offset::Utc; use std::fmt::Write; pub fn update_nightly() { let date = Utc::now().format("%Y-%m-%d").to_string(); let toolchain_update = &mut update_text_region_fn( "# begin autogenerated nightly\n", "# end autogenerated nightl...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/deprecate_lint.rs
src/tools/clippy/clippy_dev/src/deprecate_lint.rs
use crate::parse::{DeprecatedLint, Lint, ParseCx}; use crate::update_lints::generate_lint_files; use crate::utils::{UpdateMode, Version}; use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::{fs, io}; /// Runs the `deprecate` command /// /// This does the following: /// * Adds an entry to `deprecated_lints.rs...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/lint.rs
src/tools/clippy/clippy_dev/src/lint.rs
use crate::utils::{ErrAction, cargo_cmd, expect_action, run_exit_on_err}; use std::process::Command; use std::{env, fs}; #[cfg(not(windows))] static CARGO_CLIPPY_EXE: &str = "cargo-clippy"; #[cfg(windows)] static CARGO_CLIPPY_EXE: &str = "cargo-clippy.exe"; pub fn run<'a>(path: &str, edition: &str, args: impl Iterato...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/utils.rs
src/tools/clippy/clippy_dev/src/utils.rs
use core::fmt::{self, Display}; use core::marker::PhantomData; use core::num::NonZero; use core::ops::{Deref, DerefMut}; use core::range::Range; use core::str::FromStr; use std::ffi::OsStr; use std::fs::{self, OpenOptions}; use std::io::{self, Read as _, Seek as _, SeekFrom, Write}; use std::path::{Path, PathBuf}; use ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/main.rs
src/tools/clippy/clippy_dev/src/main.rs
#![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap #![warn(rust_2018_idioms, unused_lifetimes)] use clap::{Args, Parser, Subcommand}; use clippy_dev::{ ClippyInfo, UpdateMode, deprecate_lint, dogfood, fmt, lint, new_lint, new_parse_cx, release, rename_lint, serve, set...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/release.rs
src/tools/clippy/clippy_dev/src/release.rs
use crate::utils::{FileUpdater, UpdateStatus, Version, parse_cargo_package}; use std::fmt::Write; static CARGO_TOML_FILES: &[&str] = &[ "clippy_config/Cargo.toml", "clippy_lints/Cargo.toml", "clippy_utils/Cargo.toml", "declare_clippy_lint/Cargo.toml", "Cargo.toml", ]; pub fn bump_version(mut versi...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/rename_lint.rs
src/tools/clippy/clippy_dev/src/rename_lint.rs
use crate::parse::cursor::{self, Capture, Cursor}; use crate::parse::{ParseCx, RenamedLint}; use crate::update_lints::generate_lint_files; use crate::utils::{ ErrAction, FileUpdater, UpdateMode, UpdateStatus, Version, delete_dir_if_exists, delete_file_if_exists, expect_action, try_rename_dir, try_rename_file, w...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/fmt.rs
src/tools/clippy/clippy_dev/src/fmt.rs
use crate::utils::{ ErrAction, FileUpdater, UpdateMode, UpdateStatus, expect_action, run_with_output, split_args_for_threads, walk_dir_no_dot_or_target, }; use itertools::Itertools; use rustc_lexer::{FrontmatterAllowed, TokenKind, tokenize}; use std::fmt::Write; use std::fs; use std::io::{self, Read}; use std::...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/parse/cursor.rs
src/tools/clippy/clippy_dev/src/parse/cursor.rs
use core::slice; use rustc_lexer::{self as lex, LiteralKind, Token, TokenKind}; /// A token pattern used for searching and matching by the [`Cursor`]. /// /// In the event that a pattern is a multi-token sequence, earlier tokens will be consumed /// even if the pattern ultimately isn't matched. e.g. With the sequence ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/setup/intellij.rs
src/tools/clippy/clippy_dev/src/setup/intellij.rs
use std::fs; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf}; // This module takes an absolute path to a rustc repo and alters the dependencies to point towards // the respective rustc subcrates instead of using extern crate xyz. // This allows IntelliJ to analyze rustc internals and show pr...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/setup/mod.rs
src/tools/clippy/clippy_dev/src/setup/mod.rs
pub mod git_hook; pub mod intellij; pub mod toolchain; pub mod vscode;
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/setup/toolchain.rs
src/tools/clippy/clippy_dev/src/setup/toolchain.rs
use crate::utils::{cargo_cmd, run_exit_on_err}; use std::env::consts::EXE_SUFFIX; use std::env::current_dir; use std::ffi::OsStr; use std::fs; use std::path::{Path, PathBuf}; use walkdir::WalkDir; pub fn create(standalone: bool, force: bool, release: bool, name: &str) { let rustup_home = std::env::var("RUSTUP_HOME...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/setup/git_hook.rs
src/tools/clippy/clippy_dev/src/setup/git_hook.rs
use std::fs; use std::path::Path; /// Rusts setup uses `git rev-parse --git-common-dir` to get the root directory of the repo. /// I've decided against this for the sake of simplicity and to make sure that it doesn't install /// the hook if `clippy_dev` would be used in the rust tree. The hook also references this too...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/clippy_dev/src/setup/vscode.rs
src/tools/clippy/clippy_dev/src/setup/vscode.rs
use std::fs; use std::path::Path; const VSCODE_DIR: &str = ".vscode"; const TASK_SOURCE_FILE: &str = "util/etc/vscode-tasks.json"; const TASK_TARGET_FILE: &str = ".vscode/tasks.json"; pub fn install_tasks(force_override: bool) { if !check_install_precondition(force_override) { return; } match fs:...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/config.rs
src/tools/clippy/lintcheck/src/config.rs
use clap::{Parser, Subcommand, ValueEnum}; use std::num::NonZero; use std::path::PathBuf; #[expect(clippy::struct_excessive_bools)] #[derive(Parser, Clone, Debug)] #[command(args_conflicts_with_subcommands = true)] pub(crate) struct LintcheckConfig { /// Number of threads to use (default: all unless --fix or --rec...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/popular_crates.rs
src/tools/clippy/lintcheck/src/popular_crates.rs
use serde::Deserialize; use std::error::Error; use std::fmt::Write; use std::fs; use std::path::PathBuf; #[derive(Deserialize, Debug)] struct Page { crates: Vec<Crate>, meta: Meta, } #[derive(Deserialize, Debug)] struct Crate { name: String, max_version: String, } #[derive(Deserialize, Debug)] struct...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/json.rs
src/tools/clippy/lintcheck/src/json.rs
//! JSON output and comparison functionality for Clippy warnings. //! //! This module handles serialization of Clippy warnings to JSON format, //! loading warnings from JSON files, and generating human-readable diffs //! between different linting runs. use std::path::{Path, PathBuf}; use std::{fmt, fs}; use itertools...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/recursive.rs
src/tools/clippy/lintcheck/src/recursive.rs
//! In `--recursive` mode we set the `lintcheck` binary as the `RUSTC_WRAPPER` of `cargo check`, //! this allows [`crate::driver`] to be run for every dependency. The driver connects to //! [`LintcheckServer`] to ask if it should be skipped, and if not sends the stderr of running //! clippy on the crate to the server ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/main.rs
src/tools/clippy/lintcheck/src/main.rs
// Run clippy on a fixed set of crates and collect the warnings. // This helps observing the impact clippy changes have on a set of real-world code (and not just our // testsuite). // // When a new lint is introduced, we can search the results for new warnings and check for false // positives. #![feature(iter_collect_...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/output.rs
src/tools/clippy/lintcheck/src/output.rs
use cargo_metadata::diagnostic::{Diagnostic, DiagnosticSpan}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fmt::{self, Write as _}; use std::fs; use std::path::Path; use std::process::ExitStatus; use crate::config::{LintcheckConfig, OutputFormat}; /// A single emitted output from clipp...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/driver.rs
src/tools/clippy/lintcheck/src/driver.rs
use crate::recursive::{DriverInfo, deserialize_line, serialize_line}; use std::io::{self, BufReader, Write}; use std::net::TcpStream; use std::process::{self, Command, Stdio}; use std::{env, mem}; /// 1. Sends [`DriverInfo`] to the [`crate::recursive::LintcheckServer`] running on `addr` /// 2. Receives [bool] from th...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/lintcheck/src/input.rs
src/tools/clippy/lintcheck/src/input.rs
use std::collections::{HashMap, HashSet}; use std::fs::{self}; use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::process::Command; use std::time::Duration; use serde::Deserialize; use walkdir::{DirEntry, WalkDir}; use crate::{Crate, lintcheck_sources, target_dir}; const DEFAULT_DOCS_LINK: &str...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/src/main.rs
src/tools/clippy/src/main.rs
// We need this feature as it changes `dylib` linking behavior and allows us to link to // `rustc_driver`. #![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap #![warn(rust_2018_idioms, unused_lifetimes)] use std::env; use std::path::PathBuf; use std::process::{self, Command}; ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/src/driver.rs
src/tools/clippy/src/driver.rs
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] #![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap #![warn(rust_2018_idioms, unused_lifetimes)] // warn on rustc internal lints #![warn(rustc::internal)] // FIXME: switch to something mor...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/dogfood.rs
src/tools/clippy/tests/dogfood.rs
//! This test is a part of quality control and makes clippy eat what it produces. Awesome lints and //! long error messages //! //! See [Eating your own dog food](https://en.wikipedia.org/wiki/Eating_your_own_dog_food) for context #![warn(rust_2018_idioms, unused_lifetimes)] use itertools::Itertools; use std::io::{se...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/workspace.rs
src/tools/clippy/tests/workspace.rs
use std::path::PathBuf; use std::process::Command; use test_utils::{CARGO_CLIPPY_PATH, IS_RUSTC_TEST_SUITE}; mod test_utils; #[test] fn test_module_style_with_dep_in_subdir() { if IS_RUSTC_TEST_SUITE { return; } let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let target_dir = root.join("...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/check-fmt.rs
src/tools/clippy/tests/check-fmt.rs
#![warn(rust_2018_idioms, unused_lifetimes)] use std::path::PathBuf; use std::process::Command; #[test] fn fmt() { if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { return; } let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let output = Command::n...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/integration.rs
src/tools/clippy/tests/integration.rs
//! This test is meant to only be run in CI. To run it locally use: //! //! `env INTEGRATION=rust-lang/log cargo test --test integration --features=integration` //! //! You can use a different `INTEGRATION` value to test different repositories. //! //! This test will clone the specified repository and run Clippy on it....
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/lint_message_convention.rs
src/tools/clippy/tests/lint_message_convention.rs
#![warn(rust_2018_idioms, unused_lifetimes)] use std::ffi::OsStr; use std::path::PathBuf; use std::sync::LazyLock; use regex::RegexSet; #[derive(Debug)] struct Message { path: PathBuf, bad_lines: Vec<String>, } impl Message { fn new(path: PathBuf) -> Self { // we don't want the first letter afte...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/missing-test-files.rs
src/tools/clippy/tests/missing-test-files.rs
#![warn(rust_2018_idioms, unused_lifetimes)] #![allow(clippy::assertions_on_constants)] use std::cmp::Ordering; use std::ffi::OsStr; use std::fs::{self, DirEntry}; use std::path::Path; #[test] fn test_missing_tests() { let missing_files = explore_directory(Path::new("./tests")); if !missing_files.is_empty() {...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/compile-test.rs
src/tools/clippy/tests/compile-test.rs
#![feature(rustc_private)] #![warn(rust_2018_idioms, unused_lifetimes)] #![allow(unused_extern_crates)] use askama::Template; use askama::filters::Safe; use cargo_metadata::Message; use cargo_metadata::diagnostic::{Applicability, Diagnostic}; use clippy_config::ClippyConfiguration; use clippy_lints::declared_lints::LI...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/config-metadata.rs
src/tools/clippy/tests/config-metadata.rs
#![feature(rustc_private)] use clippy_config::{ClippyConfiguration, get_configuration_metadata}; use itertools::Itertools; use regex::Regex; use std::borrow::Cow; use std::{env, fs}; fn metadata() -> impl Iterator<Item = ClippyConfiguration> { get_configuration_metadata() .into_iter() .filter(|con...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/no-profile-in-cargo-toml.rs
src/tools/clippy/tests/no-profile-in-cargo-toml.rs
// Check that we do not have `profile.*` sections in our `Cargo.toml` files, // as this causes warnings when run from the compiler repository which includes // Clippy in a workspace. // // Those sections can be put into `.cargo/config.toml` which will be read // when commands are issued from the top-level Clippy direct...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/config-consistency.rs
src/tools/clippy/tests/config-consistency.rs
#![feature(rustc_private)] // This test checks that all lints defined in `clippy_config::conf` in `#[lints]` // attributes exist as Clippy lints. // // This test is a no-op if run as part of the compiler test suite // and will always succeed. use std::collections::HashSet; #[test] fn config_consistency() { if op...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/symbols-used.rs
src/tools/clippy/tests/symbols-used.rs
// This test checks that all symbols defined in Clippy's `sym.rs` file // are used in Clippy. Otherwise, it will fail with a list of symbols // which are unused. // // This test is a no-op if run as part of the compiler test suite // and will always succeed. use std::collections::HashSet; use std::ffi::OsStr; use std:...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/versioncheck.rs
src/tools/clippy/tests/versioncheck.rs
#![warn(rust_2018_idioms, unused_lifetimes)] #![allow(clippy::single_match_else)] use std::fs; #[test] fn consistent_clippy_crate_versions() { fn read_version(path: &str) -> String { let contents = fs::read_to_string(path).unwrap_or_else(|e| panic!("error reading `{path}`: {e:?}")); contents ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/repeated_is_diagnostic_item.rs
src/tools/clippy/tests/ui-internal/repeated_is_diagnostic_item.rs
#![feature(rustc_private)] extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; extern crate rustc_span; use clippy_utils::res::MaybeDef; use clippy_utils::sym; use rustc_hir::def_id::DefId; use rustc_lint::LateContext; use rustc_middle::ty::{AdtDef, Ty, TyCtxt}; use rustc_span::Symbol; fn bin...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/derive_deserialize_allowing_unknown.rs
src/tools/clippy/tests/ui-internal/derive_deserialize_allowing_unknown.rs
#![deny(clippy::derive_deserialize_allowing_unknown)] use serde::{Deserialize, Deserializer}; #[derive(Deserialize)] //~ derive_deserialize_allowing_unknown struct Struct { flag: bool, limit: u64, } #[derive(Deserialize)] //~ derive_deserialize_allowing_unknown enum Enum { A(bool), B { limit: u64 }, ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/custom_ice_message.rs
src/tools/clippy/tests/ui-internal/custom_ice_message.rs
//@rustc-env:RUST_BACKTRACE=0 //@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo" //@normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs" //@normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints" //@normalize-stderr-test: "'rustc'" -> "'<unnamed>'" //@normalize-stderr-test: "...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/check_clippy_version_attribute.rs
src/tools/clippy/tests/ui-internal/check_clippy_version_attribute.rs
#![feature(rustc_private)] #![deny(clippy::invalid_clippy_version_attribute, clippy::missing_clippy_version_attribute)] #[macro_use] extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; /////////////////////// // Valid descriptions /////////////////////// declare_tool_lint! { ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/lint_without_lint_pass.rs
src/tools/clippy/tests/ui-internal/lint_without_lint_pass.rs
#![deny(clippy::lint_without_lint_pass)] #![allow(clippy::missing_clippy_version_attribute)] #![feature(rustc_private)] #[macro_use] extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; use rustc_lint::{LintPass, LintVec}; declare_tool_lint! { //~^ lint_without_lint_pass pu...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/interning_literals_unfixable.rs
src/tools/clippy/tests/ui-internal/interning_literals_unfixable.rs
//@no-rustfix: paths that don't exist yet #![feature(rustc_private)] extern crate rustc_span; use rustc_span::Symbol; fn main() { // Not yet defined let _ = Symbol::intern("xyz123"); //~^ interning_literals let _ = Symbol::intern("with-dash"); //~^ interning_literals let _ = Symbol::intern("w...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/symbol_as_str_unfixable.rs
src/tools/clippy/tests/ui-internal/symbol_as_str_unfixable.rs
//@no-rustfix: paths that don't exist yet #![feature(rustc_private)] extern crate rustc_span; use rustc_span::Symbol; fn f(s: Symbol) { s.as_str() == "xyz123"; //~^ symbol_as_str s.as_str() == "with-dash"; //~^ symbol_as_str s.as_str() == "with.dot"; //~^ symbol_as_str }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/symbol_as_str.rs
src/tools/clippy/tests/ui-internal/symbol_as_str.rs
#![feature(rustc_private)] extern crate rustc_span; use clippy_utils::sym; use rustc_span::{Symbol, kw}; fn f(s: Symbol) { s.as_str() == "f32"; //~^ symbol_as_str s.as_str() == "proc-macro"; //~^ symbol_as_str s.as_str() == "self"; //~^ symbol_as_str s.as_str() == "msrv"; //~^ symbol_...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/interning_literals.rs
src/tools/clippy/tests/ui-internal/interning_literals.rs
#![allow(clippy::let_unit_value)] #![feature(rustc_private)] extern crate rustc_span; use clippy_utils::sym; use rustc_span::{Symbol, kw}; fn main() { let _ = Symbol::intern("f32"); //~^ interning_literals // Correct suggestion when symbol isn't stringified constant name let _ = Symbol::intern("proc...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/repeated_is_diagnostic_item_unfixable.rs
src/tools/clippy/tests/ui-internal/repeated_is_diagnostic_item_unfixable.rs
//@no-rustfix #![feature(rustc_private)] extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; extern crate rustc_span; use clippy_utils::res::MaybeDef; use clippy_utils::sym; use rustc_hir::def_id::DefId; use rustc_lint::LateContext; use rustc_middle::ty::{AdtDef, Ty, TyCtxt}; use rustc_span::S...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/disallow_span_lint.rs
src/tools/clippy/tests/ui-internal/disallow_span_lint.rs
#![feature(rustc_private)] #![deny(clippy::disallowed_methods)] extern crate rustc_errors; extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; use rustc_errors::{DiagMessage, MultiSpan}; use rustc_hir::hir_id::HirId; use rustc_lint::{Lint, LintContext}; use rustc_middle::ty::TyCtxt; pub fn a(...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/default_lint.rs
src/tools/clippy/tests/ui-internal/default_lint.rs
#![deny(clippy::default_lint)] #![allow(clippy::missing_clippy_version_attribute)] #![feature(rustc_private)] #[macro_use] extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; declare_tool_lint! { pub clippy::TEST_LINT, Warn, "", report_in_external_macro: true }...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/outer_expn_data.rs
src/tools/clippy/tests/ui-internal/outer_expn_data.rs
#![deny(clippy::outer_expn_expn_data)] #![allow(clippy::missing_clippy_version_attribute)] #![feature(rustc_private)] extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; #[macro_use] extern crate rustc_session; use rustc_hir::Expr; use rustc_lint::{LateContext, LateLintPass}; declare_lint! { ...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/collapsible_span_lint_calls.rs
src/tools/clippy/tests/ui-internal/collapsible_span_lint_calls.rs
#![deny(clippy::collapsible_span_lint_calls)] #![allow(clippy::missing_clippy_version_attribute)] #![feature(rustc_private)] extern crate clippy_utils; extern crate rustc_ast; extern crate rustc_errors; extern crate rustc_lint; extern crate rustc_session; extern crate rustc_span; use clippy_utils::diagnostics::{span_...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/invalid_msrv_attr_impl.rs
src/tools/clippy/tests/ui-internal/invalid_msrv_attr_impl.rs
#![deny(clippy::missing_msrv_attr_impl)] #![allow(clippy::missing_clippy_version_attribute)] #![feature(rustc_private)] extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_lint; extern crate rustc_middle; #[macro_use] extern crate rustc_session; use clippy_utils::extract_msrv_attr; use clippy_utils::msr...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/check_formulation.rs
src/tools/clippy/tests/ui-internal/check_formulation.rs
#![deny(clippy::almost_standard_lint_formulation)] #![allow(clippy::lint_without_lint_pass)] #![feature(rustc_private)] #[macro_use] extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; declare_tool_lint! { /// # What it does /// /// Checks for usage of correct lint...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-internal/unnecessary_def_path.rs
src/tools/clippy/tests/ui-internal/unnecessary_def_path.rs
#![feature(rustc_private)] use clippy_utils::paths::{PathLookup, PathNS}; use clippy_utils::{macro_path, sym, type_path, value_path}; static OPTION: PathLookup = type_path!(core::option::Option); //~^ unnecessary_def_path static SOME: PathLookup = type_path!(core::option::Option::Some); //~^ unnecessary_def_path sta...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/from_other_module.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/from_other_module.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/d.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/d.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/b.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/b.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/c.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/c.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/main.rs
mod a; mod b; #[path = "b.rs"] mod b2; mod c; #[path = "c.rs"] mod c2; #[path = "c.rs"] mod c3; mod from_other_module; mod other_module; mod d; #[path = "d.rs"] mod d2; #[path = "d.rs"] #[expect(clippy::duplicate_mod)] mod d3; #[path = "d.rs"] #[allow(clippy::duplicate_mod)] mod d4; fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/a.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/a.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/other_module/mod.rs
src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/src/other_module/mod.rs
#[path = "../from_other_module.rs"] mod m;
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_crate_versions/fail/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_crate_versions/fail/src/main.rs
#![warn(clippy::multiple_crate_versions)] fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_crate_versions/12145_with_dashes/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_crate_versions/12145_with_dashes/src/main.rs
#![warn(clippy::multiple_crate_versions)] fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_crate_versions/pass/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_crate_versions/pass/src/main.rs
#![warn(clippy::multiple_crate_versions)] fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_crate_versions/5041_allow_dev_build/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_crate_versions/5041_allow_dev_build/src/main.rs
#![warn(clippy::multiple_crate_versions)] fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_crate_versions/12176_allow_duplicate_crates/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_crate_versions/12176_allow_duplicate_crates/src/main.rs
#![warn(clippy::multiple_crate_versions)] fn main() {}
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/src/lib.rs
src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/src/lib.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/lint_groups_priority/pass/src/lib.rs
src/tools/clippy/tests/ui-cargo/lint_groups_priority/pass/src/lib.rs
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/clippy/tests/ui-cargo/multiple_config_files/warn/src/main.rs
src/tools/clippy/tests/ui-cargo/multiple_config_files/warn/src/main.rs
fn main() { println!("Hello, world!"); }
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false