Bump rust to 1.57, fix new lint failures

This commit is contained in:
Blaž Hrastnik 2021-12-03 12:48:07 +09:00
parent d31bef7fea
commit 34f46e7502
8 changed files with 55 additions and 95 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"devshell": {
"locked": {
"lastModified": 1632436039,
"narHash": "sha256-OtITeVWcKXn1SpVEnImpTGH91FycCskGBPqmlxiykv4=",
"lastModified": 1637575296,
"narHash": "sha256-ZY8YR5u8aglZPe27+AJMnPTG6645WuavB+w0xmhTarw=",
"owner": "numtide",
"repo": "devshell",
"rev": "7a7a7aa0adebe5488e5abaec688fd9ae0f8ea9c6",
"rev": "0e56ef21ba1a717169953122c7415fa6a8cd2618",
"type": "github"
},
"original": {
@ -17,11 +17,11 @@
},
"flake-utils": {
"locked": {
"lastModified": 1623875721,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
"lastModified": 1637014545,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
"type": "github"
},
"original": {
@ -41,11 +41,11 @@
]
},
"locked": {
"lastModified": 1634796585,
"narHash": "sha256-CW4yx6omk5qCXUIwXHp/sztA7u0SpyLq9NEACPnkiz8=",
"lastModified": 1638425401,
"narHash": "sha256-xc8ayvR3u90hSCMEy0zHHKav7lEgljAFXL4oIkWRp3M=",
"owner": "yusdacra",
"repo": "nix-cargo-integration",
"rev": "a84a2137a396f303978f1d48341e0390b0e16a8b",
"rev": "1f8b511bb30f7d7b9051dfbb4784390bc0d48d37",
"type": "github"
},
"original": {
@ -56,11 +56,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1634782485,
"narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=",
"lastModified": 1638376152,
"narHash": "sha256-ucgLpVqhFnClH7YRUHBHnmiOd82RZdFR3XJt36ks5fE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be",
"rev": "6daa4a5c045d40e6eae60a3b6e427e8700f1c07f",
"type": "github"
},
"original": {
@ -72,15 +72,16 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1628186154,
"narHash": "sha256-r2d0wvywFnL9z4iptztdFMhaUIAaGzrSs7kSok0PgmE=",
"lastModified": 1637453606,
"narHash": "sha256-Gy6cwUswft9xqsjWxFYEnx/63/qzaFUwatcbV5GF/GQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "06552b72346632b6943c8032e57e702ea12413bf",
"rev": "8afc4e543663ca0a6a4f496262cd05233737e732",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -98,11 +99,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1634869268,
"narHash": "sha256-RVAcEFlFU3877Mm4q/nbXGEYTDg/wQNhzmXGMTV6wBs=",
"lastModified": 1638497756,
"narHash": "sha256-zKOvMKqGp71ZBnR+hBlPcv4TwNN82COW9EF+6ygrFs8=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c02c2d86354327317546501af001886fbb53d374",
"rev": "783722a22ee5d762ac5c1c7b418b57b3010c827a",
"type": "github"
},
"original": {

View File

@ -2256,7 +2256,7 @@ mod cmd {
args: &[&str],
event: PromptEvent,
) -> anyhow::Result<()> {
quit_all_impl(&mut cx.editor, args, event, false)
quit_all_impl(cx.editor, args, event, false)
}
fn force_quit_all(
@ -2264,7 +2264,7 @@ mod cmd {
args: &[&str],
event: PromptEvent,
) -> anyhow::Result<()> {
quit_all_impl(&mut cx.editor, args, event, true)
quit_all_impl(cx.editor, args, event, true)
}
fn cquit(
@ -2300,7 +2300,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
yank_main_selection_to_clipboard_impl(&mut cx.editor, ClipboardType::Clipboard)
yank_main_selection_to_clipboard_impl(cx.editor, ClipboardType::Clipboard)
}
fn yank_joined_to_clipboard(
@ -2313,7 +2313,7 @@ mod cmd {
.first()
.copied()
.unwrap_or_else(|| doc.line_ending.as_str());
yank_joined_to_clipboard_impl(&mut cx.editor, separator, ClipboardType::Clipboard)
yank_joined_to_clipboard_impl(cx.editor, separator, ClipboardType::Clipboard)
}
fn yank_main_selection_to_primary_clipboard(
@ -2321,7 +2321,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
yank_main_selection_to_clipboard_impl(&mut cx.editor, ClipboardType::Selection)
yank_main_selection_to_clipboard_impl(cx.editor, ClipboardType::Selection)
}
fn yank_joined_to_primary_clipboard(
@ -2334,7 +2334,7 @@ mod cmd {
.first()
.copied()
.unwrap_or_else(|| doc.line_ending.as_str());
yank_joined_to_clipboard_impl(&mut cx.editor, separator, ClipboardType::Selection)
yank_joined_to_clipboard_impl(cx.editor, separator, ClipboardType::Selection)
}
fn paste_clipboard_after(
@ -2342,7 +2342,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Clipboard)
paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard)
}
fn paste_clipboard_before(
@ -2350,7 +2350,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Clipboard)
paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard)
}
fn paste_primary_clipboard_after(
@ -2358,7 +2358,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Selection)
paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection)
}
fn paste_primary_clipboard_before(
@ -2366,7 +2366,7 @@ mod cmd {
_args: &[&str],
_event: PromptEvent,
) -> anyhow::Result<()> {
paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Selection)
paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection)
}
fn replace_selections_with_clipboard_impl(
@ -2544,7 +2544,7 @@ mod cmd {
let line = args[0].parse::<usize>()?;
goto_line_impl(&mut cx.editor, NonZeroUsize::new(line));
goto_line_impl(cx.editor, NonZeroUsize::new(line));
let (view, doc) = current!(cx.editor);
@ -3545,7 +3545,7 @@ fn push_jump(editor: &mut Editor) {
}
fn goto_line(cx: &mut Context) {
goto_line_impl(&mut cx.editor, cx.count)
goto_line_impl(cx.editor, cx.count)
}
fn goto_line_impl(editor: &mut Editor, count: Option<NonZeroUsize>) {
@ -4445,7 +4445,7 @@ fn yank_joined_to_clipboard_impl(
fn yank_joined_to_clipboard(cx: &mut Context) {
let line_ending = doc!(cx.editor).line_ending;
let _ = yank_joined_to_clipboard_impl(
&mut cx.editor,
cx.editor,
line_ending.as_str(),
ClipboardType::Clipboard,
);
@ -4473,20 +4473,20 @@ fn yank_main_selection_to_clipboard_impl(
}
fn yank_main_selection_to_clipboard(cx: &mut Context) {
let _ = yank_main_selection_to_clipboard_impl(&mut cx.editor, ClipboardType::Clipboard);
let _ = yank_main_selection_to_clipboard_impl(cx.editor, ClipboardType::Clipboard);
}
fn yank_joined_to_primary_clipboard(cx: &mut Context) {
let line_ending = doc!(cx.editor).line_ending;
let _ = yank_joined_to_clipboard_impl(
&mut cx.editor,
cx.editor,
line_ending.as_str(),
ClipboardType::Selection,
);
}
fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
let _ = yank_main_selection_to_clipboard_impl(&mut cx.editor, ClipboardType::Selection);
let _ = yank_main_selection_to_clipboard_impl(cx.editor, ClipboardType::Selection);
exit_select_mode(cx);
}
@ -4569,19 +4569,19 @@ fn paste_clipboard_impl(
}
fn paste_clipboard_after(cx: &mut Context) {
let _ = paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Clipboard);
let _ = paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard);
}
fn paste_clipboard_before(cx: &mut Context) {
let _ = paste_clipboard_impl(&mut cx.editor, Paste::Before, ClipboardType::Clipboard);
let _ = paste_clipboard_impl(cx.editor, Paste::Before, ClipboardType::Clipboard);
}
fn paste_primary_clipboard_after(cx: &mut Context) {
let _ = paste_clipboard_impl(&mut cx.editor, Paste::After, ClipboardType::Selection);
let _ = paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection);
}
fn paste_primary_clipboard_before(cx: &mut Context) {
let _ = paste_clipboard_impl(&mut cx.editor, Paste::Before, ClipboardType::Selection);
let _ = paste_clipboard_impl(cx.editor, Paste::Before, ClipboardType::Selection);
}
fn replace_with_yanked(cx: &mut Context) {
@ -4638,11 +4638,11 @@ fn replace_selections_with_clipboard_impl(
}
fn replace_selections_with_clipboard(cx: &mut Context) {
let _ = replace_selections_with_clipboard_impl(&mut cx.editor, ClipboardType::Clipboard);
let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Clipboard);
}
fn replace_selections_with_primary_clipboard(cx: &mut Context) {
let _ = replace_selections_with_clipboard_impl(&mut cx.editor, ClipboardType::Selection);
let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Selection);
}
fn paste_after(cx: &mut Context) {
@ -5157,7 +5157,7 @@ fn expand_selection(cx: &mut Context) {
doc.set_selection(view.id, selection);
}
};
motion(&mut cx.editor);
motion(cx.editor);
cx.editor.last_motion = Some(Motion(Box::new(motion)));
}
@ -5389,7 +5389,7 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) {
});
doc.set_selection(view.id, selection);
};
textobject(&mut cx.editor);
textobject(cx.editor);
cx.editor.last_motion = Some(Motion(Box::new(textobject)));
}
})
@ -5719,7 +5719,7 @@ fn rename_symbol(cx: &mut Context) {
let task = language_server.rename_symbol(doc.identifier(), pos, input.to_string());
let edits = block_on(task).unwrap_or_default();
log::debug!("Edits from LSP: {:?}", edits);
apply_workspace_edit(&mut cx.editor, offset_encoding, &edits);
apply_workspace_edit(cx.editor, offset_encoding, &edits);
},
);
cx.push_layer(Box::new(prompt));

View File

@ -922,7 +922,7 @@ impl EditorView {
impl Component for EditorView {
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
let mut cxt = commands::Context {
editor: &mut cx.editor,
editor: cx.editor,
count: None,
register: None,
callback: None,

View File

@ -46,7 +46,7 @@ pub struct FilePicker<T> {
}
pub enum CachedPreview {
Document(Document),
Document(Box<Document>),
Binary,
LargeFile,
NotFound,
@ -140,7 +140,7 @@ impl<T> FilePicker<T> {
_ => {
// TODO: enable syntax highlighting; blocked by async rendering
Document::open(path, None, Some(&editor.theme), None)
.map(CachedPreview::Document)
.map(|doc| CachedPreview::Document(Box::new(doc)))
.unwrap_or(CachedPreview::NotFound)
}
},
@ -421,19 +421,19 @@ impl<T: 'static> Component for Picker<T> {
}
key!(Enter) => {
if let Some(option) = self.selection() {
(self.callback_fn)(&mut cx.editor, option, Action::Replace);
(self.callback_fn)(cx.editor, option, Action::Replace);
}
return close_fn;
}
ctrl!('s') => {
if let Some(option) = self.selection() {
(self.callback_fn)(&mut cx.editor, option, Action::HorizontalSplit);
(self.callback_fn)(cx.editor, option, Action::HorizontalSplit);
}
return close_fn;
}
ctrl!('v') => {
if let Some(option) = self.selection() {
(self.callback_fn)(&mut cx.editor, option, Action::VerticalSplit);
(self.callback_fn)(cx.editor, option, Action::VerticalSplit);
}
return close_fn;
}

View File

@ -102,7 +102,7 @@ impl Default for Cell {
/// buf.get_mut(5, 0).set_char('x');
/// assert_eq!(buf.get(5, 0).symbol, "x");
/// ```
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Buffer {
/// The area represented by this buffer
pub area: Rect,
@ -111,15 +111,6 @@ pub struct Buffer {
pub content: Vec<Cell>,
}
impl Default for Buffer {
fn default() -> Buffer {
Buffer {
area: Default::default(),
content: Vec::new(),
}
}
}
impl Buffer {
/// Returns a Buffer with all cells set to the default one
pub fn empty(area: Rect) -> Buffer {

View File

@ -195,15 +195,9 @@ impl<'a> From<&'a str> for Span<'a> {
}
/// A string composed of clusters of graphemes, each with their own style.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Spans<'a>(pub Vec<Span<'a>>);
impl<'a> Default for Spans<'a> {
fn default() -> Spans<'a> {
Spans(Vec::new())
}
}
impl<'a> Spans<'a> {
/// Returns the width of the underlying string.
///
@ -280,17 +274,11 @@ impl<'a> From<Spans<'a>> for String {
/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
/// assert_eq!(6, text.height());
/// ```
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Text<'a> {
pub lines: Vec<Spans<'a>>,
}
impl<'a> Default for Text<'a> {
fn default() -> Text<'a> {
Text { lines: Vec::new() }
}
}
impl<'a> Text<'a> {
/// Create some text (potentially multiple lines) with no style.
///

View File

@ -363,21 +363,12 @@ impl<'a> Table<'a> {
}
}
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct TableState {
pub offset: usize,
pub selected: Option<usize>,
}
impl Default for TableState {
fn default() -> TableState {
TableState {
offset: 0,
selected: None,
}
}
}
impl TableState {
pub fn selected(&self) -> Option<usize> {
self.selected

View File

@ -25,7 +25,7 @@ pub struct Margin {
/// A simple rectangle used in the computation of the layout and to give widgets an hint about the
/// area they are supposed to render to. (x, y) = (0, 0) is at the top left corner of the screen.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
#[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq)]
pub struct Rect {
pub x: u16,
pub y: u16,
@ -33,17 +33,6 @@ pub struct Rect {
pub height: u16,
}
impl Default for Rect {
fn default() -> Rect {
Rect {
x: 0,
y: 0,
width: 0,
height: 0,
}
}
}
impl Rect {
/// Creates a new rect, with width and height limited to keep the area under max u16.
/// If clipped, aspect ratio will be preserved.