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");
|
let mut s = f.debug_struct("CompletionItem");
|
||||||
s.field("label", &self.label).field("source_range", &self.source_range);
|
s.field("label", &self.label).field("source_range", &self.source_range);
|
||||||
if self.text_edit.len() == 1 {
|
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("delete", &atom.delete);
|
||||||
s.field("insert", &atom.insert);
|
s.field("insert", &atom.insert);
|
||||||
} else {
|
} 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 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);
|
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_lints: Vec<ClippyLint> = Vec::new();
|
||||||
let mut clippy_groups: std::collections::BTreeMap<String, Vec<String>> = Default::default();
|
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": ""#) {
|
if let Some(line) = line.strip_prefix(r#""id": ""#) {
|
||||||
let clippy_lint = ClippyLint {
|
let clippy_lint = ClippyLint {
|
||||||
id: line.strip_suffix(r#"","#).expect("should be suffixed by comma").into(),
|
id: line.strip_suffix(r#"","#).expect("should be suffixed by comma").into(),
|
||||||
@ -211,12 +211,19 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) {
|
|||||||
.push(clippy_lints.last().unwrap().id.clone());
|
.push(clippy_lints.last().unwrap().id.clone());
|
||||||
}
|
}
|
||||||
} else if let Some(line) = line.strip_prefix(r#""docs": ""#) {
|
} else if let Some(line) = line.strip_prefix(r#""docs": ""#) {
|
||||||
let prefix_to_strip = r#" ### What it does"#;
|
let header = "### What it does";
|
||||||
let line = match line.strip_prefix(prefix_to_strip) {
|
let line = match line.find(header) {
|
||||||
Some(line) => line,
|
Some(idx) => &line[idx + header.len()..],
|
||||||
None => {
|
None => {
|
||||||
eprintln!("unexpected clippy prefix for {}", clippy_lints.last().unwrap().id);
|
let id = &clippy_lints.last().unwrap().id;
|
||||||
continue;
|
// 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
|
// Only take the description, any more than this is a lot of additional data we would embed into the exe
|
||||||
|
@ -5266,38 +5266,46 @@ pub fn foo() {}
|
|||||||
#[test]
|
#[test]
|
||||||
fn hover_feature() {
|
fn hover_feature() {
|
||||||
check(
|
check(
|
||||||
r#"#![feature(box_syntax$0)]"#,
|
r#"#![feature(intrinsics$0)]"#,
|
||||||
expect![[r##"
|
expect![[r#"
|
||||||
*box_syntax*
|
*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
|
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.
|
||||||
|
|
||||||
See also [`box_patterns`](box-patterns.md)
|
------------------------
|
||||||
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
Currently the only stable way to create a `Box` is via the `Box::new` method.
|
These are imported as if they were FFI functions, with the special
|
||||||
Also it is not possible in stable Rust to destructure a `Box` in a match
|
`rust-intrinsic` ABI. For example, if one was in a freestanding
|
||||||
pattern. The unstable `box` keyword can be used to create a `Box`. An example
|
context, but wished to be able to `transmute` between types, and
|
||||||
usage would be:
|
perform efficient pointer arithmetic, one would import those functions
|
||||||
|
via a declaration like
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![feature(box_syntax)]
|
#![feature(intrinsics)]
|
||||||
|
#![allow(internal_features)]
|
||||||
|
# fn main() {}
|
||||||
|
|
||||||
fn main() {
|
extern "rust-intrinsic" {
|
||||||
let b = box 5;
|
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.
|
// This file.
|
||||||
"slow-tests/tidy.rs",
|
"slow-tests/tidy.rs",
|
||||||
"test-utils/src/fixture.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)) {
|
if text.contains("#[should_panic") && !need_panic.iter().any(|p| path.ends_with(p)) {
|
||||||
panic!(
|
panic!(
|
||||||
|
Loading…
Reference in New Issue
Block a user