Auto merge of #15680 - DaniPopes:regenerate-lints, r=Veykril
internal: re-generate lints.rs Looks like this hasn't been run in a while
This commit is contained in:
commit
e478db717e
@ -89,7 +89,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut s = f.debug_struct("CompletionItem");
|
||||
s.field("label", &self.label).field("source_range", &self.source_range);
|
||||
if self.text_edit.len() == 1 {
|
||||
let atom = &self.text_edit.iter().next().unwrap();
|
||||
let atom = self.text_edit.iter().next().unwrap();
|
||||
s.field("delete", &atom.delete);
|
||||
s.field("insert", &atom.insert);
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,7 @@ pub struct LintGroup {
|
||||
|
||||
let contents = sourcegen::add_preamble("sourcegen_lints", sourcegen::reformat(contents));
|
||||
|
||||
let destination = project_root().join("crates/ide_db/src/generated/lints.rs");
|
||||
let destination = project_root().join("crates/ide-db/src/generated/lints.rs");
|
||||
sourcegen::ensure_file_contents(destination.as_path(), &contents);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) {
|
||||
let mut clippy_lints: Vec<ClippyLint> = Vec::new();
|
||||
let mut clippy_groups: std::collections::BTreeMap<String, Vec<String>> = Default::default();
|
||||
|
||||
for line in file_content.lines().map(|line| line.trim()) {
|
||||
for line in file_content.lines().map(str::trim) {
|
||||
if let Some(line) = line.strip_prefix(r#""id": ""#) {
|
||||
let clippy_lint = ClippyLint {
|
||||
id: line.strip_suffix(r#"","#).expect("should be suffixed by comma").into(),
|
||||
@ -211,13 +211,20 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) {
|
||||
.push(clippy_lints.last().unwrap().id.clone());
|
||||
}
|
||||
} else if let Some(line) = line.strip_prefix(r#""docs": ""#) {
|
||||
let prefix_to_strip = r#" ### What it does"#;
|
||||
let line = match line.strip_prefix(prefix_to_strip) {
|
||||
Some(line) => line,
|
||||
let header = "### What it does";
|
||||
let line = match line.find(header) {
|
||||
Some(idx) => &line[idx + header.len()..],
|
||||
None => {
|
||||
eprintln!("unexpected clippy prefix for {}", clippy_lints.last().unwrap().id);
|
||||
let id = &clippy_lints.last().unwrap().id;
|
||||
// these just don't have the common header
|
||||
let allowed = ["allow_attributes", "read_line_without_trim"];
|
||||
if allowed.contains(&id.as_str()) {
|
||||
line
|
||||
} else {
|
||||
eprintln!("\nunexpected clippy prefix for {id}, line={line:?}\n",);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
};
|
||||
// Only take the description, any more than this is a lot of additional data we would embed into the exe
|
||||
// which seems unnecessary
|
||||
|
@ -5266,38 +5266,46 @@ pub fn foo() {}
|
||||
#[test]
|
||||
fn hover_feature() {
|
||||
check(
|
||||
r#"#![feature(box_syntax$0)]"#,
|
||||
expect![[r##"
|
||||
*box_syntax*
|
||||
r#"#![feature(intrinsics$0)]"#,
|
||||
expect![[r#"
|
||||
*intrinsics*
|
||||
```
|
||||
box_syntax
|
||||
intrinsics
|
||||
```
|
||||
___
|
||||
|
||||
# `box_syntax`
|
||||
# `intrinsics`
|
||||
|
||||
The tracking issue for this feature is: [#49733]
|
||||
The tracking issue for this feature is: None.
|
||||
|
||||
[#49733]: https://github.com/rust-lang/rust/issues/49733
|
||||
|
||||
See also [`box_patterns`](box-patterns.md)
|
||||
Intrinsics are never intended to be stable directly, but intrinsics are often
|
||||
exported in some sort of stable manner. Prefer using the stable interfaces to
|
||||
the intrinsic directly when you can.
|
||||
|
||||
------------------------
|
||||
|
||||
Currently the only stable way to create a `Box` is via the `Box::new` method.
|
||||
Also it is not possible in stable Rust to destructure a `Box` in a match
|
||||
pattern. The unstable `box` keyword can be used to create a `Box`. An example
|
||||
usage would be:
|
||||
|
||||
These are imported as if they were FFI functions, with the special
|
||||
`rust-intrinsic` ABI. For example, if one was in a freestanding
|
||||
context, but wished to be able to `transmute` between types, and
|
||||
perform efficient pointer arithmetic, one would import those functions
|
||||
via a declaration like
|
||||
|
||||
```rust
|
||||
#![feature(box_syntax)]
|
||||
#![feature(intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
# fn main() {}
|
||||
|
||||
fn main() {
|
||||
let b = box 5;
|
||||
extern "rust-intrinsic" {
|
||||
fn transmute<T, U>(x: T) -> U;
|
||||
|
||||
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
|
||||
}
|
||||
```
|
||||
|
||||
"##]],
|
||||
As with any other FFI functions, these are always `unsafe` to call.
|
||||
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,8 @@ fn check_test_attrs(path: &Path, text: &str) {
|
||||
// This file.
|
||||
"slow-tests/tidy.rs",
|
||||
"test-utils/src/fixture.rs",
|
||||
// Generated code from lints contains doc tests in string literals.
|
||||
"ide-db/src/generated/lints.rs",
|
||||
];
|
||||
if text.contains("#[should_panic") && !need_panic.iter().any(|p| path.ends_with(p)) {
|
||||
panic!(
|
||||
|
Loading…
Reference in New Issue
Block a user